pub struct VecWithPositionsAllDifferent<T> { /* private fields */ }Expand description
Example: Several threads use a pool of network nodes to download from. From the pool we “view” a range of currently used nodes, one by thread. If a note is invalidated, it is removed from the list and the lacking thread is moved to the end of the list receiving a new node. Nodes later than it in the range decrease their positions. Despite of the name, positions can be the same, if shortage of the pool.
Implementations§
Source§impl<T> VecWithPositionsAllDifferent<T>
impl<T> VecWithPositionsAllDifferent<T>
pub fn push(&mut self, value: T)
pub fn append(&mut self, other: &mut Vec<T>)
pub fn remove(&mut self, index: usize) -> T
pub fn clear(&mut self)
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn new_position(&mut self) -> Position
pub fn get(&self, index: usize) -> Option<&T>
pub fn get_mut(&mut self, index: usize) -> Option<&mut T>
pub fn set(&mut self, index: usize, value: T)
pub fn get_by_position(&self, pos: Position) -> Option<&T>
pub fn get_mut_by_position(&mut self, pos: Position) -> Option<&mut T>
pub fn set_by_position(&mut self, pos: Position, value: T)
Auto Trait Implementations§
impl<T> Freeze for VecWithPositionsAllDifferent<T>
impl<T> RefUnwindSafe for VecWithPositionsAllDifferent<T>where
T: RefUnwindSafe,
impl<T> Send for VecWithPositionsAllDifferent<T>where
T: Send,
impl<T> Sync for VecWithPositionsAllDifferent<T>where
T: Sync,
impl<T> Unpin for VecWithPositionsAllDifferent<T>where
T: Unpin,
impl<T> UnwindSafe for VecWithPositionsAllDifferent<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