Crate io_lifetimes[−][src]
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 API | This 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
andIntoRawFd
returnRawFd
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_ffi | This is just a sample of what FFI using this crate can look like. |
views | Typed views using temporary objects. |
Structs
BorrowedHandle | A borrowed handle. |
BorrowedSocket | A borrowed socket. |
OptionFileHandle | Similar to |
OwnedHandle | An owned handle. |
OwnedSocket | An owned socket. |
Traits
AsFilelike | A portable trait to borrow a reference from an underlying filelike object. |
AsHandle | A trait to borrow the handle from an underlying object. |
AsSocket | A trait to borrow the socket from an underlying object. |
AsSocketlike | A portable trait to borrow a reference from an underlying socketlike object. |
FromFilelike | A portable trait to express the ability to construct an object from a filelike object. |
FromHandle | A trait to express the ability to construct an object from a handle. |
FromSocket | A trait to express the ability to construct an object from a socket. |
FromSocketlike | A portable trait to express the ability to construct an object from a socketlike object. |
IntoFilelike | A portable trait to express the ability to consume an object and acquire ownership of its filelike object. |
IntoHandle | A trait to express the ability to consume an object and acquire ownership of its handle. |
IntoSocket | A trait to express the ability to consume an object and acquire ownership of its socket. |
IntoSocketlike | A portable trait to express the ability to consume an object and acquire ownership of its socketlike object. |
Type Definitions
BorrowedFilelike | A reference to a filelike object. |
BorrowedSocketlike | A reference to a socketlike object. |
OwnedFilelike | An owned filelike object. |
OwnedSocketlike | An owned socketlike object. |