Struct StructureChainVec

Source
pub struct StructureChainVec<H: ExtendableStructure> { /* private fields */ }
Expand description

Structure Chain that can take an arbitrary number of structures extending it This is done by putting the structures on the heap

Implementations§

Source§

impl<H> StructureChainVec<H>

Source

pub fn new(head: H) -> Self

Source

pub fn new_with_capacity(head: H, capacity: usize) -> Self

Source

pub fn push<T: ExtendingStructure<H> + 'static>(&mut self, structure: T)

Add a new structure to the structure chain Note: No check is done that the structure is not already part of this structure chain When pushing a structure, it is pushed in a linked state

Trait Implementations§

Source§

impl<H> AsMut<H> for StructureChainVec<H>

Source§

fn as_mut(&mut self) -> &mut H

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<H> AsRef<H> for StructureChainVec<H>

Source§

fn as_ref(&self) -> &H

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<H> StructureChain<H> for StructureChainVec<H>

Source§

fn get_mut<T: ExtendingStructure<H>>(&mut self) -> &mut T

Return a mutable reference to the given structure Will panic if this structure is not part of the structure chain
Source§

fn get<T: ExtendingStructure<H>>(&self) -> &T

Return a reference to the given structure Will panic if this structure is not part of the structure chain
Unlink the given structure from the chain Will panic if this structure is not part of the structure chain
Link the given structure from the chain Do not call this on a structure that has not been unlinked previously Calling link on an already linked structure is safe but has the side effect of unlinking all the other structures linked before the two link calls (which you probably do not want) Will panic if this structure is not part of the structure chain

Auto Trait Implementations§

§

impl<H> !Freeze for StructureChainVec<H>

§

impl<H> !RefUnwindSafe for StructureChainVec<H>

§

impl<H> !Send for StructureChainVec<H>

§

impl<H> !Sync for StructureChainVec<H>

§

impl<H> Unpin for StructureChainVec<H>
where H: Unpin,

§

impl<H> !UnwindSafe for StructureChainVec<H>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Alias<T> for T