Circular

Struct Circular 

Source
pub struct Circular<T> { /* private fields */ }

Implementations§

Source§

impl<T> Circular<T>

We have a vector and “position” therein.

TODO: More tests.

Source

pub fn new() -> Self

Source

pub fn vec(&self) -> &Vec<T>

Source

pub fn push(&mut self, value: T)

Source

pub fn append(&mut self, other: &mut Vec<T>)

Source

pub fn remove_unsafe(&mut self, index: usize) -> T

Source

pub fn remove_by_pos_id(&mut self, pos_id: PositionID) -> Option<T>

Source

pub fn is_empty(&self) -> bool

Source

pub fn len(&self) -> usize

Source

pub fn positions_is_empty(&self) -> bool

Source

pub fn positions_len(&self) -> usize

Source

pub fn iter(&self) -> Iter<'_, T>

Source

pub fn iter_mut(&mut self) -> IterMut<'_, T>

Source

pub fn create_position(&mut self) -> PositionID

Source

pub fn destroy_position(&mut self, pos_id: PositionID)

Source

pub fn get_position(&self, pos_id: PositionID) -> &Option<usize>

Source

pub fn set_position_unsafe(&mut self, pos_id: PositionID, index: Option<usize>)

Source

pub fn get_by_pos_id(&self, pos_id: PositionID) -> Option<&T>

Source

pub fn get_by_pos_id_mut(&mut self, pos_id: PositionID) -> Option<&mut T>

Source

pub fn force_get_by_pos_id_mut(&mut self, pos_id: PositionID) -> Option<&mut T>

If current is None tries to set it to Some.

Source

pub fn clear(&mut self)

Source

pub fn next(&mut self, pos_id: PositionID) -> Option<&T>

Auto Trait Implementations§

§

impl<T> Freeze for Circular<T>

§

impl<T> RefUnwindSafe for Circular<T>
where T: RefUnwindSafe,

§

impl<T> Send for Circular<T>
where T: Send,

§

impl<T> Sync for Circular<T>
where T: Sync,

§

impl<T> Unpin for Circular<T>
where T: Unpin,

§

impl<T> UnwindSafe for Circular<T>
where T: UnwindSafe,

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.