Skip to main content

Crate io_lifetimes

Crate io_lifetimes 

Source
Available on Hermit or Unix or WASI or Windows only.
Expand description

Experimental new types and traits to replace the Raw family of types and traits.

This API has much conceptual similarity with the Raw API, but introduces explicit concepts of ownership and borrowing:

Raw APIThis experimental API
Raw*Borrowed* and Owned*
AsRaw*As*
IntoRaw*Into*
FromRaw*From*

This gives it several advantages:

  • Less unsafe in user code!

  • Easier to understand ownership.

  • It avoids the inconsistency where AsRawFd and IntoRawFd return RawFd values that users ought to be able to trust, but aren’t unsafe, so it’s possible to fail to uphold this trust in purely safe Rust.

  • It enables a number of safe and portable convenience features, such as safe typed views and from+into conversions.

Modules§

example_fficlose
This is just a sample of what FFI using this crate can look like.
raw
Portability abstractions over Raw*.
views
Typed views using temporary objects.

Structs§

BorrowedFdUnix
A borrowed file descriptor.
OwnedFdUnix
An owned file descriptor.

Traits§

AsFdUnix
A trait to borrow the file descriptor from an underlying object.
AsFilelike
A portable trait to borrow a reference from an underlying filelike object.
AsSocketlike
A portable trait to borrow a reference from an underlying socketlike object.
FromFdHermit or Unix or WASI
A trait to express the ability to construct an object from a file descriptor.
FromFilelike
A portable trait to express the ability to construct an object from a filelike object.
FromSocketlike
A portable trait to express the ability to construct an object from a socketlike object.
IntoFdDeprecatedHermit or Unix or WASI
A trait to express the ability to consume an object and acquire ownership of its file descriptor.
IntoFilelike
A portable trait to express the ability to consume an object and acquire ownership of its filelike object.
IntoSocketlike
A portable trait to express the ability to consume an object and acquire ownership of its socketlike object.

Type Aliases§

BorrowedFilelikeHermit or Unix or WASI
A reference to a filelike object.
BorrowedSocketlikeHermit or Unix or WASI
A reference to a socketlike object.
OwnedFilelikeHermit or Unix or WASI
An owned filelike object.
OwnedSocketlikeHermit or Unix or WASI
An owned socketlike object.