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>where
H: ExtendableStructure,
impl<H> StructureChainVec<H>where
H: ExtendableStructure,
pub fn new(head: H) -> Self
pub fn new_with_capacity(head: H, capacity: usize) -> Self
Sourcepub fn push<T: ExtendingStructure<H> + 'static>(&mut self, structure: T)
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>where
H: ExtendableStructure,
impl<H> AsMut<H> for StructureChainVec<H>where
H: ExtendableStructure,
Source§impl<H> AsRef<H> for StructureChainVec<H>where
H: ExtendableStructure,
impl<H> AsRef<H> for StructureChainVec<H>where
H: ExtendableStructure,
Source§impl<H> StructureChain<H> for StructureChainVec<H>where
H: ExtendableStructure,
impl<H> StructureChain<H> for StructureChainVec<H>where
H: ExtendableStructure,
Source§fn get_mut<T: ExtendingStructure<H>>(&mut self) -> &mut T
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
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
Source§fn unlink<T: ExtendingStructure<H>>(&mut self)
fn unlink<T: ExtendingStructure<H>>(&mut self)
Unlink the given structure from the chain
Will panic if this structure is not part of the structure chain
Source§fn link<T: ExtendingStructure<H>>(&mut self)
fn link<T: ExtendingStructure<H>>(&mut self)
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more