[][src]Struct generic_vec::iter::Cursor

pub struct Cursor<'a, T, S: ?Sized + Storage<T>> { /* fields omitted */ }

This struct is created by GenericVec::cursor. See its documentation for more.

Implementations

impl<'a, T, S: ?Sized + Storage<T>> Cursor<'a, T, S>[src]

pub fn as_raw_cursor_mut(&mut self) -> &mut RawCursor<'a, T, S>[src]

Get a mutable reference to the underlying RawCursor

Updating the state of the underlying RawCursor does update the state of this Cursor

pub fn len(&self) -> usize[src]

The number of remaining elements in range of this Cursor

The Cursor is empty when there are 0 remaining elements

pub fn is_empty(&self) -> bool[src]

Returns true if the Cursor is empty

pub fn is_write_empty(&self) -> bool[src]

Returns true if the Cursor is has no unfilled slots and the Cursor is empty

pub fn is_write_front_empty(&self) -> bool[src]

Returns true if there is an unfilled slot at the front of the Cursor

pub fn is_write_back_empty(&self) -> bool[src]

Returns true if there is an unfilled slot at the back of the Cursor

pub fn write_len(&self) -> usize[src]

Returns the number of unfilled slots if the Cursor is empty if the Cursor is not empty, the behavior is unspecified

pub fn write_front_len(&self) -> usize[src]

Returns the number of unfilled slots at the front of the Cursor

pub fn write_back_len(&self) -> usize[src]

Returns the number of unfilled slots at the back of the Cursor

pub fn front(&self) -> Option<&T>[src]

Returns a reference to the next element of the Cursor. Returns None if the Cursor is empty

Note: this does not advance the Cursor or change the number of unfilled slots

pub fn front_mut(&mut self) -> Option<&mut T>[src]

Returns a mutable reference to the next element of the Cursor. Returns None if the Cursor is empty

Note: this does not advance the Cursor or change the number of unfilled slots

pub fn back(&self) -> Option<&T>[src]

Returns a reference to the last element of the Cursor. Returns None if the Cursor is empty

Note: this does not advance the Cursor or change the number of unfilled slots

pub fn back_mut(&mut self) -> Option<&mut T>[src]

Returns a mutable reference to the last element of the Cursor. Returns None if the Cursor is empty

Note: this does not advance the Cursor or change the number of unfilled slots

pub fn take_front(&mut self) -> T[src]

Removes the next element of the Cursor and removes it from the underlying GenericVec

Advances the Cursor by 1 element

Creates 1 unfilled slot at the front of the Cursor.

Panic

Panics if the Cursor is empty

pub fn take_back(&mut self) -> T[src]

Removes the last element of the Cursor and removes it from the underlying [GenericVec`]

Advances the Cursor by 1 element

Creates 1 unfilled slot at the back of the Cursor.

Panic

Panics if the Cursor is empty

pub fn drop_front(&mut self)[src]

Drops the next element of the Cursor and removes them it the underlying GenericVec

Advances the Cursor by 1 element

Creates 1 unfilled slot at the front of the Cursor.

Panic

Panics if the Cursor is empty

pub fn drop_back(&mut self)[src]

Drops the last element of the Cursor and removes them it the underlying GenericVec

Advances the Cursor by 1 element

Creates 1 unfilled slot at the back of the Cursor.

Panic

Panics if the Cursor is empty

pub fn drop_n_front(&mut self, n: usize)[src]

Drops the next n elements of the Cursor and removes them from the underlying GenericVec

Advances the Cursor by n elements

Creates n unfilled slots at the front of the Cursor.

Panic

Panics if the Cursor's length is less than n

pub fn drop_n_back(&mut self, n: usize)[src]

Drops the last n elements of the Cursor and removes them from the underlying GenericVec

Advances the Cursor by n elements

Creates n unfilled slots at the back of the Cursor.

Panic

Panics if the Cursor's length is less than n

pub fn try_write_front(&mut self, value: T) -> Result<(), T>[src]

Returns Ok(()) and writes value into the unfilled slot at the front of the Cursor if there is an unfilled slot at the front of the Cursor

If there are no unfilled slots at the front of the Cursor then return Err(value)

Fills in 1 unfilled slot at the front of the Cursor on success

pub fn write_front(&mut self, value: T)[src]

Writes value into the unfilled slot at the front of the Cursor if there is an unfilled slot at the front of the Cursor

Fills in 1 unfilled slot at the front of the Cursor

Panic

Panics if there are no unfilled slots at the front of the Cursor

pub fn try_write_back(&mut self, value: T) -> Result<(), T>[src]

Returns Ok(()) and writes value into the unfilled slot at the back of the Cursor if there is an unfilled slot at the back of the Cursor

If there are no unfilled slots at the back of the Cursor then return Err(value)

Fills in 1 unfilled slot at the back of the Cursor on success

pub fn write_back(&mut self, value: T)[src]

Writes value into the unfilled slot at the back of the Cursor if there is an unfilled slot at the back of the Cursor

Fills in 1 unfilled slot at the back of the Cursor

Panic

Panics if there are no unfilled slots at the back of the Cursor

pub fn write_slice_front(&mut self, slice: &[T]) where
    T: Copy
[src]

Copies slice into the unfilled slots at the front of the Cursor if there are slice.len() unfilled slots at the front of the Cursor

Fills in slice.len() unfilled slots at the front of the Cursor

Panic

Panics if there are less than slice.len() unfilled slots at the front of the Cursor

pub fn write_slice_back(&mut self, slice: &[T]) where
    T: Copy
[src]

Copies slice into the unfilled slots at the back of the Cursor if there are slice.len() unfilled slots at the back of the Cursor

Fills in slice.len() unfilled slots at the back of the Cursor

Panic

Panics if there are less than slice.len() unfilled slots at the back of the Cursor

pub fn skip_front(&mut self)[src]

Skips the next element of the Cursor and keeps it in the underlying GenericVec

Advances the Cursor by 1 element

Does not change the number of unfilled slots.

Panic

Panics if the Cursor is empty

pub fn skip_back(&mut self)[src]

Skips the last element of the Cursor and keeps it in the underlying GenericVec

Advances the Cursor by 1 element

Does not change the number of unfilled slots.

Panic

Panics if the Cursor is empty

pub fn skip_n_front(&mut self, n: usize)[src]

Skips the next n elements of the Cursor and keeps them in the underlying GenericVec

Advances the Cursor by n elements

Does not change the number of unfilled slots.

Panic

Panics if the Cursor's length is less than n

pub fn skip_n_back(&mut self, n: usize)[src]

Skips the last n elements of the Cursor and keeps them in the underlying GenericVec

Advances the Cursor by n elements

Does not change the number of unfilled slots.

Panic

Panics if the Cursor's length is less than n

pub fn reserve(&mut self, space: usize)[src]

Reserve at least space unfilled slots in the Cursor

Panic

  • Panics if the Cursor is not empty
  • May panic if the underlying GenericVec cannot reserve more space

Auto Trait Implementations

impl<'a, T, S: ?Sized> RefUnwindSafe for Cursor<'a, T, S> where
    S: RefUnwindSafe,
    T: RefUnwindSafe

impl<'a, T, S: ?Sized> Send for Cursor<'a, T, S> where
    S: Send,
    T: Send

impl<'a, T, S: ?Sized> Sync for Cursor<'a, T, S> where
    S: Sync,
    T: Sync

impl<'a, T, S: ?Sized> Unpin for Cursor<'a, T, S>

impl<'a, T, S> !UnwindSafe for Cursor<'a, T, S>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.