RawCursor

Struct RawCursor 

Source
pub struct RawCursor<'a, S: ?Sized + Storage> { /* private fields */ }
Expand description

This struct is created by [GenericVec::raw_cursor]. See its documentation for more.

Implementations§

Source§

impl<'a, S: ?Sized + Storage> RawCursor<'a, S>

Source

pub fn finish(&mut self)

Skip all the remaining elements, and ensure that the [GenericVec] is valid

Source

pub fn len(&self) -> usize

The number of remaining elements in range of this RawCursor

The RawCursor is empty when there are 0 remaining elements

Source

pub fn is_empty(&self) -> bool

Returns true if the RawCursor is empty

Source

pub fn is_write_empty(&self) -> bool

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

Source

pub fn is_write_front_empty(&self) -> bool

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

Source

pub fn is_write_back_empty(&self) -> bool

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

Source

pub fn write_len(&self) -> usize

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

Source

pub fn write_front_len(&self) -> usize

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

Source

pub fn write_back_len(&self) -> usize

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

Source

pub unsafe fn front(&self) -> &S::Item

Returns a reference to the next element of the RawCursor.

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

§Safety

The RawCursor must not be empty

Source

pub unsafe fn front_mut(&mut self) -> &mut S::Item

Returns a mutable reference to the next element of the RawCursor.

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

§Safety

The RawCursor must not be empty

Source

pub unsafe fn back(&self) -> &S::Item

Returns a reference to the last element of the RawCursor.

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

§Safety

The RawCursor must not be empty

Source

pub unsafe fn back_mut(&mut self) -> &mut S::Item

Returns a mutable reference to the last element of the RawCursor.

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

§Safety

The RawCursor must not be empty

Source

pub unsafe fn take_front(&mut self) -> S::Item

Removes the next element of the RawCursor and removes it from the underlying [GenericVec]

Advances the RawCursor by 1 element

Creates 1 unfilled slot at the front of the RawCursor.

§Safety

The RawCursor must not be empty

Source

pub unsafe fn take_back(&mut self) -> S::Item

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

Advances the RawCursor by 1 element

Creates 1 unfilled slot at the back of the RawCursor.

§Safety

The RawCursor must not be empty

Source

pub unsafe fn drop_front(&mut self)

Drops the next element of the RawCursor and removes them it the underlying [GenericVec]

Advances the RawCursor by 1 element

Creates 1 unfilled slot at the front of the RawCursor.

§Safety

The RawCursor must not be empty

Source

pub unsafe fn drop_back(&mut self)

Drops the last element of the RawCursor and removes them it the underlying [GenericVec]

Advances the RawCursor by 1 element

Creates 1 unfilled slot at the back of the RawCursor.

§Safety

The RawCursor must not be empty

Source

pub unsafe fn drop_n_front(&mut self, n: usize)

Drops the next n elements of the RawCursor and removes them from the underlying [GenericVec]

Advances the RawCursor by n elements

Creates n unfilled slots at the front of the RawCursor.

§Safety

The RawCursor’s length must be at least equal to n

Source

pub unsafe fn drop_n_back(&mut self, n: usize)

Drops the last n elements of the RawCursor and removes them from the underlying [GenericVec]

Advances the RawCursor by n elements

Creates n unfilled slots at the back of the RawCursor.

§Safety

The RawCursor’s length must be at least equal to n

Source

pub unsafe fn write_front(&mut self, value: S::Item)

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

Fills in 1 unfilled slot at the front of the RawCursor

§Safety

There must be at least 1 unfilled slot at the front of the RawCursor

Source

pub unsafe fn write_back(&mut self, value: S::Item)

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

Fills in 1 unfilled slot at the back of the RawCursor

§Safety

There must be at least 1 unfilled slot at the back of the RawCursor

Source

pub unsafe fn write_slice_front(&mut self, slice: &[S::Item])

Moves slice into the unfilled slots at the front of the RawCursor if there are slice.len() unfilled slots at the front of the RawCursor

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

§Safety
  • There must be at least slice.len() unfilled slots at the front of the RawCursor
  • You must not drop any of the values in slice
Source

pub unsafe fn write_slice_back(&mut self, slice: &[S::Item])

Moves slice into the unfilled slots at the back of the RawCursor if there are slice.len() unfilled slots at the back of the RawCursor

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

§Safety
  • There must be at least slice.len() unfilled slots at the back of the RawCursor
  • You must not drop any of the values in slice
Source

pub unsafe fn skip_front(&mut self)

Skips the next element of the RawCursor and keeps it in the underlying [GenericVec]

Advances the RawCursor by 1 element

Does not change the number of unfilled slots.

§Safety

The RawCursor must not be empty

Source

pub unsafe fn skip_back(&mut self)

Skips the last element of the RawCursor and keeps it in the underlying [GenericVec]

Advances the RawCursor by 1 element

Does not change the number of unfilled slots.

§Safety

The RawCursor must not be empty

Source

pub unsafe fn skip_n_front(&mut self, n: usize)

Skips the next n elements of the RawCursor and keeps them in the underlying [GenericVec]

Advances the RawCursor by n elements

Does not change the number of unfilled slots.

§Safety

The RawCursor’s length must be at least equal to n

Source

pub unsafe fn skip_n_back(&mut self, n: usize)

Skips the last n elements of the RawCursor and keeps them in the underlying [GenericVec]

Advances the RawCursor by n elements

Does not change the number of unfilled slots.

§Safety

The RawCursor’s length must be at least equal to n

Source

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

Reserve at least space unfilled slots in the RawCursor

§Panics
  • Panics if the RawCursor is not empty
  • May panic if the underlying [GenericVec] cannot reserve more space

Trait Implementations§

Source§

impl<S: ?Sized + Storage> Drop for RawCursor<'_, S>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<S: ?Sized + Storage + Send> Send for RawCursor<'_, S>
where S::Item: Send,

Source§

impl<S: ?Sized + Storage + Sync> Sync for RawCursor<'_, S>
where S::Item: Sync,

Auto Trait Implementations§

§

impl<'a, S> Freeze for RawCursor<'a, S>
where S: ?Sized,

§

impl<'a, S> RefUnwindSafe for RawCursor<'a, S>

§

impl<'a, S> Unpin for RawCursor<'a, S>
where S: ?Sized,

§

impl<'a, S> !UnwindSafe for RawCursor<'a, S>

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.