@Test public void bracket(@Mock ResultSet resultSet) throws SQLException { when(resultSet.getString("id")).thenReturn("value"); ZIO<Nothing, Throwable, String> bracket = ZIO.bracket(open(resultSet), getString("id")); assertEquals(Either.right("value"), bracket.provide(nothing())); verify(resultSet).close(); }
@Override public void close() { resource.toOption().ifPresent(release); }
ZIOResource implements AutoCloseable { @Override public void close() { resource.toOption().ifPresent(release); } }
ZIOResource implements AutoCloseable { @Override public void close() { resource.toOption().ifPresent(release); } ZIOResource(Either<E, ? extends A> resource, Consumer1<? super A> release); }
ZIOResource implements AutoCloseable { @Override public void close() { resource.toOption().ifPresent(release); } ZIOResource(Either<E, ? extends A> resource, Consumer1<? super A> release); ZIO<R, E, B> apply(Function1<? super A, ? extends ZIO<R, E, ? extends B>> use); @Override void close(); }
ZIOResource implements AutoCloseable { @Override public void close() { resource.toOption().ifPresent(release); } ZIOResource(Either<E, ? extends A> resource, Consumer1<? super A> release); ZIO<R, E, B> apply(Function1<? super A, ? extends ZIO<R, E, ? extends B>> use); @Override void close();  }