Package 

Class AutoCloseKt

  • All Implemented Interfaces:

    
    public final class AutoCloseKt
    
                        
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final static <R extends Any, T extends BaseCoAcceptor<R>> R use(T $self, SuspendFunction1<T, Unit> block) Use an acceptor and auto-close it on completion.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • use

         final static <R extends Any, T extends BaseCoAcceptor<R>> R use(T $self, SuspendFunction1<T, Unit> block)

        Use an acceptor and auto-close it on completion. Unlike the similar function for AutoCloseable, this function returns the result of the acceptor, not the return value of the block.

        Parameters:
        block - a lambda to be executed with the acceptor as a parameter