const fileName_1 = "(@effect/core) _src/io/Scope/operations/use.ts";
import * as tsplus_module_1 from "@effect/core/io/Scope/operations/close";
import * as tsplus_module_2 from "@effect/core/io/Scope/operations/extend";
import * as tsplus_module_3 from "@effect/core/io/Effect/operations/onExit";
/**
 * Uses the scope by providing it to an `Effect` workflow that needs a scope,
 * guaranteeing that the scope is closed with the result of that workflow as
 * soon as the workflow completes execution, whether by success, failure, or
 * interruption.
 *
 * @tsplus fluent ets/Scope/Closeable use
 */

export function use_(self, effect) {
  return tsplus_module_3.onExit_(tsplus_module_2.extend_(self, effect), exit => tsplus_module_1.close_(self, () => exit), fileName_1 + ":13:36");
}
/**
 * Uses the scope by providing it to an `Effect` workflow that needs a scope,
 * guaranteeing that the scope is closed with the result of that workflow as
 * soon as the workflow completes execution, whether by success, failure, or
 * interruption.
 *
 * @tsplus static ets/Scope/Aspects use
 */

export const use = effect => self => use_(self, effect);
//# sourceMappingURL=use.mjs.map