Struct FD

File descriptor wrapper

struct FD ;

This wrapper's main purpose is to protect the fd against leakage. It does not actually do anything.

Constructors

NameDescription
this Initialize from an OS file descriptor.
this Open a new file.

Properties

NameTypeDescription
fileNo[get] intObtain the underlying OS handle
isValid[get] boolReport whether the FD currently holds a valid fd

Methods

NameDescription
adopt Wrapper for adopting an fd immediately after being returned from external function
checkedCall Run an fd based function and throw if it fails
close Close the OS handle prematurely.
dup Duplicate an FD
osCall Call an OS function that accepts an FD as the first argument.
read @safe read
write @safe write