scoped property

ZIO<R, E, A> scoped

Provide a Scope to this ZIO. All finalizers added to the Scope will be run at this point of the execution.

Implementation

ZIO<R, E, A> get scoped => ZIO.from((ctx) {
      final scope = Scope.withEnv(ctx.env);
      return alwaysIgnore(scope.closeScope()).unsafeRun(ctx.withEnv(scope));
    });