pub trait Intrusive: IntrusiveBase {
Show 17 methods // Required methods unsafe fn from_alias(ia: IntrusiveAlias) -> Self; unsafe fn into_alias(self) -> IntrusiveAlias; fn as_alias_mut(&mut self) -> &mut IntrusiveAlias; unsafe fn of_alias(ia: &IntrusiveAlias) -> &Self; unsafe fn of_alias_mut(ia: &mut IntrusiveAlias) -> &mut Self; fn from_container(c: OwnBox<Self::Container>) -> Self; fn into_container(self) -> OwnBox<Self::Container>; fn of_container(c: &Self::Container) -> BorrowBox<'_, Self>; fn of_container_mut(c: &mut Self::Container) -> BorrowBoxMut<'_, Self>; fn as_container(&self) -> &Self::Container; fn as_container_mut(&mut self) -> &mut Self::Container; unsafe fn from_field(c: OwnBox<Self::Field>) -> Self; fn into_field(self) -> OwnBox<Self::Field>; unsafe fn of_field(c: &Self::Field) -> BorrowBox<'_, Self>; unsafe fn of_field_mut(c: &mut Self::Field) -> BorrowBoxMut<'_, Self>; fn as_field(&self) -> &Self::Field; fn as_field_mut(&mut self) -> &mut Self::Field;
}
Expand description

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 containerof_intrusive! macro.

Required Methods§

source

unsafe fn from_alias(ia: IntrusiveAlias) -> Self

Ownership-moving translation from generic intrusive pointer alias to type-safe intrusive pointer.

§Safety

This converts a raw pointer to an owned pointer, which is unsafe per Rust’s memory model.

source

unsafe fn into_alias(self) -> IntrusiveAlias

Ownership-moving translation from type-safe intrusive pointer to generic intrusive pointer.

§Safety

This converts an owned pointer to a raw pointer, which is unsafe per Rust’s memory model.

source

fn as_alias_mut(&mut self) -> &mut IntrusiveAlias

Allow using type-safe intrusive pointer as mutable generic intrusive pointer.

source

unsafe fn of_alias(ia: &IntrusiveAlias) -> &Self

Allow using generic intrusive pointer as type-safe intrusive pointer.

§Safety

This converts a raw pointer to a borrowed reference, which is unsafe per Rust’s memory model.

source

unsafe fn of_alias_mut(ia: &mut IntrusiveAlias) -> &mut Self

Allow using generic intrusive pointer as mutable type-safe intrusive pointer.

§Safety

This converts a raw pointer to a mutable borrowed reference, which is unsafe per Rust’s memory model.

source

fn from_container(c: OwnBox<Self::Container>) -> Self

Represent ownership of a container as ownership of an Intrusive pointer type. (Inverse of into_container.)

source

fn into_container(self) -> OwnBox<Self::Container>

Represent ownership of an Intrusive pointer type as ownership of its container. (Inverse of from_container.)

source

fn of_container(c: &Self::Container) -> BorrowBox<'_, Self>

Represent a borrow of an intrusive type via a borrow of its container.

source

fn of_container_mut(c: &mut Self::Container) -> BorrowBoxMut<'_, Self>

Represent a mutable borrow of an intrusive type via a mutable borrow of its container.

source

fn as_container(&self) -> &Self::Container

Grant referential access to the container of this intrusive pointer type.

source

fn as_container_mut(&mut self) -> &mut Self::Container

Grant mutable referential access to the container of this intrusive pointer type.

source

unsafe fn from_field(c: OwnBox<Self::Field>) -> Self

Assuming the “field” is a field in the container object, take ownership of the field as an intrusive pointer, allowing eventual translation back to the container. (Inverse of into_field.)

§Safety

The caller must ensure that the OwnBox argument was constructed from this type.

source

fn into_field(self) -> OwnBox<Self::Field>

Represent ownership of the container object as ownership of the intrusive field in the object. (Inverse of from_field.)

source

unsafe fn of_field(c: &Self::Field) -> BorrowBox<'_, Self>

Represent a borrow of an intrusive type via a borrow of the intrusive field.

§Safety

The caller must ensure that the self::Field argument was constructed from this type.

source

unsafe fn of_field_mut(c: &mut Self::Field) -> BorrowBoxMut<'_, Self>

Represent a mutable borrow of an intrusive type via a mutable borrow of the intrusive field.

§Safety

The caller must ensure that the self::Field argument was constructed from this type.

source

fn as_field(&self) -> &Self::Field

Grant referential access to the intrusive field represented by this intrusive pointer.

source

fn as_field_mut(&mut self) -> &mut Self::Field

Grant mutable referential access to the intrusive field represented by this intrusive pointer.

Object Safety§

This trait is not object safe.

Implementors§