Struct io_lifetimes::OptionFileHandle[][src]

#[repr(transparent)]
pub struct OptionFileHandle { /* fields omitted */ }
Expand description

Similar to Option<OwnedHandle>, but intended for use in FFI interfaces where [INVALID_HANDLE_VALUE] is used as the sentry value, and null values are not used at all, such as in the return value of CreateFileW.

If this holds an owned handle, it closes the handle on drop.

This uses repr(transparent) and has the representation of a host handle, so it can be used in FFI in places where a non-null handle is passed as a consumed argument or returned as an owned value, or it is [INVALID_HANDLE_VALUE] indicating an error or an otherwise absent value.

Implementations

Return an empty OptionFileHandle with no resource.

Trait Implementations

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Performs the conversion.

Constructs a new instance of Self from the given handle. Read more

Constructs a new instance of Self from the given handle converted from into_owned. Read more

Constructs a new instance of Self from the given raw handle.

Safety

The resource pointed to by raw must be either open and otherwise unowned, or equal to [INVALID_FILE_HANDLE]. Note that not all Windows APIs use [INVALID_HANDLE_VALUE] for errors; see here for the full story.

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.