Type Alias MutCursor

Source
pub type MutCursor<'a, E, I, const IE: usize, const LE: usize> = SafeCursor<&'a mut ContentTreeRaw<E, I, IE, LE>, E, I, IE, LE>;
Expand description

A mutable cursor into a ContentTree. Mutable cursors inherit all the functionality of Cursor, and can also be used to modify the content tree.

A mutable cursor mutably borrows the content tree. Only one mutable cursor can exist at a time.

Aliased Type§

#[repr(transparent)]
pub struct MutCursor<'a, E, I, const IE: usize, const LE: usize> { pub inner: UnsafeCursor<E, I, IE, LE>, /* private fields */ }

Fields§

§inner: UnsafeCursor<E, I, IE, LE>

Implementations§

Source§

impl<'a, E: ContentTraits, I: TreeMetrics<E>, const IE: usize, const LE: usize> MutCursor<'a, E, I, IE, LE>

Source

pub unsafe fn unchecked_from_raw( _tree: &mut Pin<Box<ContentTreeRaw<E, I, IE, LE>>>, cursor: UnsafeCursor<E, I, IE, LE>, ) -> Self

Source

pub fn insert_notify<F>(&mut self, new_entry: E, notify: F)
where F: FnMut(E, NonNull<NodeLeaf<E, I, IE, LE>>),

Source

pub fn insert(&mut self, new_entry: E)

Source

pub fn replace_range_notify<N>(&mut self, new_entry: E, notify: N)
where N: FnMut(E, NonNull<NodeLeaf<E, I, IE, LE>>),

Source

pub fn replace_range(&mut self, new_entry: E)

Source

pub fn delete_notify<F>(&mut self, del_items: usize, notify: F)
where F: FnMut(E, NonNull<NodeLeaf<E, I, IE, LE>>),

Source

pub fn delete(&mut self, del_items: usize)

Source

pub fn replace_entry(&mut self, items: &[E])

Replace the current entry with the items passed via items[]. Items.len must be <= 3. The cursor offset is ignored. This is a fancy method - use sparingly.

Source

pub fn replace_entry_simple(&mut self, new_item: E)

Source

pub fn mutate_single_entry_notify<MapFn, R, N>( &mut self, replace_max: usize, notify: N, map_fn: MapFn, ) -> (usize, R)
where N: FnMut(E, NonNull<NodeLeaf<E, I, IE, LE>>), MapFn: FnOnce(&mut E) -> R,

Mutate a single entry in-place. The entry to be modified is whatever is at this cursor, and up to replace_max size.

The function will be modified by the (passed) map_fn.

Returns a tuple of (actual length replaced, map_fn return value).

Methods from Deref<Target = Cursor<'a, E, I, IE, LE>>§

Source

pub fn count_pos_raw<Out, F, G, H>( &self, offset_to_num: F, entry_len: G, entry_len_at: H, ) -> Out
where Out: AddAssign + Default, F: Fn(I::Value) -> Out, G: Fn(&E) -> Out, H: Fn(&E, usize) -> Out,

Source

pub fn insert_notify<F>(&mut self, new_entry: E, notify: F)
where F: FnMut(E, NonNull<NodeLeaf<E, I, IE, LE>>),

Source

pub fn insert(&mut self, new_entry: E)

Source

pub fn replace_range_notify<N>(&mut self, new_entry: E, notify: N)
where N: FnMut(E, NonNull<NodeLeaf<E, I, IE, LE>>),

Source

pub fn replace_range(&mut self, new_entry: E)

Source

pub fn delete_notify<F>(&mut self, del_items: usize, notify: F)
where F: FnMut(E, NonNull<NodeLeaf<E, I, IE, LE>>),

Source

pub fn delete(&mut self, del_items: usize)

Source

pub fn replace_entry(&mut self, items: &[E])

Replace the current entry with the items passed via items[]. Items.len must be <= 3. The cursor offset is ignored. This is a fancy method - use sparingly.

Source

pub fn replace_entry_simple(&mut self, new_item: E)

Source

pub fn mutate_single_entry_notify<MapFn, R, N>( &mut self, replace_max: usize, notify: N, map_fn: MapFn, ) -> (usize, R)
where N: FnMut(E, NonNull<NodeLeaf<E, I, IE, LE>>), MapFn: FnOnce(&mut E) -> R,

Mutate a single entry in-place. The entry to be modified is whatever is at this cursor, and up to replace_max size.

The function will be modified by the (passed) map_fn.

Returns a tuple of (actual length replaced, map_fn return value).

Source

pub fn count_content_pos(&self) -> usize

Source

pub fn count_offset_pos(&self) -> usize

Source

pub fn get_item(&self) -> Option<E::Item>

Trait Implementations§

Source§

impl<'a, E: ContentTraits, I: TreeMetrics<E>, const IE: usize, const LE: usize> Deref for MutCursor<'a, E, I, IE, LE>

Source§

type Target = SafeCursor<&'a ContentTreeRaw<E, I, IE, LE>, E, I, IE, LE>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'a, E: ContentTraits, I: TreeMetrics<E>, const IE: usize, const LE: usize> DerefMut for MutCursor<'a, E, I, IE, LE>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.