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>
impl<'a, S: ?Sized + Storage> RawCursor<'a, S>
Sourcepub fn finish(&mut self)
pub fn finish(&mut self)
Skip all the remaining elements, and ensure that the [GenericVec
] is
valid
Sourcepub fn len(&self) -> usize
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
Sourcepub fn is_write_empty(&self) -> bool
pub fn is_write_empty(&self) -> bool
Returns true
if the RawCursor
is has no unfilled slots
and the RawCursor
is empty
Sourcepub fn is_write_front_empty(&self) -> bool
pub fn is_write_front_empty(&self) -> bool
Returns true if there is an unfilled slot at the front
of the RawCursor
Sourcepub fn is_write_back_empty(&self) -> bool
pub fn is_write_back_empty(&self) -> bool
Returns true if there is an unfilled slot at the back
of the RawCursor
Sourcepub fn write_len(&self) -> usize
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
Sourcepub fn write_front_len(&self) -> usize
pub fn write_front_len(&self) -> usize
Returns the number of unfilled slots at the front
of the RawCursor
Sourcepub fn write_back_len(&self) -> usize
pub fn write_back_len(&self) -> usize
Returns the number of unfilled slots at the back
of the RawCursor
Sourcepub unsafe fn front(&self) -> &S::Item
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
Sourcepub unsafe fn front_mut(&mut self) -> &mut S::Item
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
Sourcepub unsafe fn back(&self) -> &S::Item
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
Sourcepub unsafe fn back_mut(&mut self) -> &mut S::Item
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
Sourcepub unsafe fn take_front(&mut self) -> S::Item
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
Sourcepub unsafe fn take_back(&mut self) -> S::Item
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
Sourcepub unsafe fn drop_front(&mut self)
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
Sourcepub unsafe fn drop_back(&mut self)
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
Sourcepub unsafe fn drop_n_front(&mut self, n: usize)
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
Sourcepub unsafe fn drop_n_back(&mut self, n: usize)
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
Sourcepub unsafe fn write_front(&mut self, value: S::Item)
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
Sourcepub unsafe fn write_back(&mut self, value: S::Item)
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
Sourcepub unsafe fn write_slice_front(&mut self, slice: &[S::Item])
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 theRawCursor
- You must not drop any of the values in
slice
Sourcepub unsafe fn write_slice_back(&mut self, slice: &[S::Item])
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 theRawCursor
- You must not drop any of the values in
slice
Sourcepub unsafe fn skip_front(&mut self)
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
Sourcepub unsafe fn skip_back(&mut self)
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
Sourcepub unsafe fn skip_n_front(&mut self, n: usize)
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
Sourcepub unsafe fn skip_n_back(&mut self, n: usize)
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