pub struct List<Tag, T: Copy> {
head: Option<T>,
tail: Option<T>,
len: usize,
_tag: PhantomData<Tag>,
}Fields§
§head: Option<T>§tail: Option<T>§len: usize§_tag: PhantomData<Tag>Implementations§
Source§impl<Tag, T: Copy + PartialEq> List<Tag, T>
impl<Tag, T: Copy + PartialEq> List<Tag, T>
pub const fn new() -> Self
pub fn head(&self) -> Option<T>
pub fn tail(&self) -> Option<T>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn push_front<S: Get<T> + GetMut<T>>( &mut self, id: T, storage: &mut S, ) -> Result<(), Error>
Sourcepub fn push_back<S: Get<T> + GetMut<T>>(
&mut self,
id: T,
storage: &mut S,
) -> Result<(), Error>
pub fn push_back<S: Get<T> + GetMut<T>>( &mut self, id: T, storage: &mut S, ) -> Result<(), Error>
Pushes id to the back of the list. If id is already in the list, it is moved to the back.
Errors if id does not exist in storage or if the node corresponding to id is linked but not in the list.
pub fn pop_front<S: Get<T> + GetMut<T>>( &mut self, storage: &mut S, ) -> Result<Option<T>, Error>
pub fn pop_back<S: Get<T> + GetMut<T>>( &mut self, storage: &mut S, ) -> Result<Option<T>, Error>
Auto Trait Implementations§
impl<Tag, T> Freeze for List<Tag, T>where
T: Freeze,
impl<Tag, T> RefUnwindSafe for List<Tag, T>where
T: RefUnwindSafe,
Tag: RefUnwindSafe,
impl<Tag, T> Send for List<Tag, T>
impl<Tag, T> Sync for List<Tag, T>
impl<Tag, T> Unpin for List<Tag, T>
impl<Tag, T> UnwindSafe for List<Tag, T>where
T: UnwindSafe,
Tag: UnwindSafe,
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