MCPcopy Index your code
hub / github.com/Effect-TS/effect / toScoped

Function toScoped

packages/effect/src/internal/scopedCache.ts:146–156  ·  view source on GitHub ↗
(
  self: Complete<Key, Value, Error>
)

Source from the content-addressed store, hash-verified

144
145/** @internal */
146export const toScoped = <Key, Value, Error = never>(
147 self: Complete<Key, Value, Error>
148): Effect.Effect<Value, Error, Scope.Scope> =>
149 Exit.matchEffect(self.exit, {
150 onFailure: (cause) => core.failCause(cause),
151 onSuccess: ([value]) =>
152 fiberRuntime.acquireRelease(
153 core.as(core.sync(() => MutableRef.incrementAndGet(self.ownerCount)), value),
154 () => releaseOwner(self)
155 )
156 })
157
158/** @internal */
159export const releaseOwner = <Key, Value, Error = never>(

Callers 2

resolveMapValueMethod · 0.85
lookupValueOfMethod · 0.85

Calls 3

releaseOwnerFunction · 0.85
failCauseMethod · 0.80
syncMethod · 0.80

Tested by

no test coverage detected