Trait containerof::Intrusive [] [src]

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

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

unsafe fn from_alias(IntrusiveAlias) -> Self

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

unsafe fn into_alias(self) -> IntrusiveAlias

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

unsafe fn as_alias_mut<'a>(&'a mut self) -> &'a mut IntrusiveAlias

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

unsafe fn of_alias<'a>(&'a IntrusiveAlias) -> &'a Self

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

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

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

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

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

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

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

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

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

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

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

fn as_container<'a>(&'a self) -> &'a Self::Container

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

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

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

unsafe fn from_field(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.)

unsafe 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.)

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

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

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

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

fn as_field<'a>(&'a self) -> &'a Self::Field

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

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

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

Implementors