pub struct List<T> { /* private fields */ }
Expand description
A collection designed for the specific requirements of storing Calls with an associated index.
The requirements found in HFP v1.8, Section 4.34.2, “+CLCC”:
- Each call is assigned a number starting at 1.
- Calls hold their number until they are released.
- New calls take the lowest available number.
Note: “Insert” is a O(n) operation in order to simplify the implementation. This data structure is best suited towards small n for this reason.
Implementations§
Source§impl<T> List<T>
impl<T> List<T>
Sourcepub fn insert(&mut self, value: T) -> Idx
pub fn insert(&mut self, value: T) -> Idx
Insert a new value into the list, returning an index that is guaranteed to be unique until the value is removed from the list.
Sourcepub fn get(&self, index: Idx) -> Option<&T>
pub fn get(&self, index: Idx) -> Option<&T>
Retrieve a value by index. Returns None
if the index does not point to a value.
Sourcepub fn get_mut(&mut self, index: Idx) -> Option<&mut T>
pub fn get_mut(&mut self, index: Idx) -> Option<&mut T>
Retrieve a mutable reference to a value by index. Returns None
if the index does not point
to a value.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for List<T>
impl<T> RefUnwindSafe for List<T>where
T: RefUnwindSafe,
impl<T> Send for List<T>where
T: Send,
impl<T> Sync for List<T>where
T: Sync,
impl<T> Unpin for List<T>where
T: Unpin,
impl<T> UnwindSafe for List<T>where
T: 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