Crate containerof [−] [src]
Intrusive structure support in Rust.
An intrusive structure is a general-purpose structure directly embedded within a containing structure, in order to add that general-purpose facility to the container. As an example, one might use an intrusive "link" structure to allow objects to be organized in a linked-list:
Example
struct Link { next: Option<ContainerLink>, } struct List { head: Option<ContainerLink>, tail: Option<ContainerLink>, } struct Container { link: Link, } containerof_intrusive!(ContainerLink = Container:link::Link);
Macros
containerof_field_offset |
Implement C-like |
containerof_intrusive |
Define a type representing the translation between an intrusive field and its containing structure. |
Structs
BorrowBox |
A borrow-pointer that does not require explicit ownership of the value being borrowed. Used to allow construction of the Intrusive structure translation type from a borrow pointer. |
BorrowBoxMut |
A mutable borrow-pointer that does not require explicit ownership of the value being borrowed. Used to allow construction of the Intrusive structure translation type from a mutable borrow pointer. |
IntrusiveAlias |
Alias that has the same representation as an intrusive translation type. The idea is to be able to use this alias for intrusive facility implementations, by defining the "true" implementation of the facility to use the single (but type-unsafe) IntrusiveAlias type, while allowing type-safe wrapper implementations to delegate their behavior to the implementation function. |
OwnBox |
Represent ownership of an object via ownership of an intrusive
field within the object. Differs from Rust-standard |
Traits
Intrusive |
Trait defining routines for translation between containing
structure and intrusive field. The only implementors of this trait
should be the translation-types defined by the
|
IntrusiveBase |
Minimal trait that, when implemented for a type, allows for the
blanket implementation of the Intrusive trait for that type. This
is the trait implemented by the |