FileDescriptor

public protocol FileDescriptor

Undocumented

  • Will be called with the file descriptor if still open, if not it will throw an IOError.

    The ownership of the file descriptor must not escape the body as it’s completely managed by the implementation of the FileDescriptor protocol.

    Throws

    If either the FileDescriptor was closed before or the closure throws by itself.

    Declaration

    Swift

    func withUnsafeFileDescriptor<T>(_ body: (CInt) throws -> T) throws -> T

    Parameters

    body

    The closure to execute if the FileDescriptor is still open.

  • true if this FileDescriptor is open (which means it was not closed yet).

    Declaration

    Swift

    var isOpen: Bool { get }
  • Close this FileDescriptor.

    Declaration

    Swift

    func close() throws