Struct SafeCursor

Source
#[repr(transparent)]
pub struct SafeCursor<R, E: ContentTraits, I: TreeMetrics<E>, const IE: usize = DEFAULT_IE, const LE: usize = DEFAULT_LE> { 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> SafeCursor<&'a ContentTreeRaw<E, I, IE, LE>, E, I, IE, LE>

This file provides the safe implementation methods for cursors.

Source

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

Source§

impl<R, E: ContentTraits, I: TreeMetrics<E>, const IE: usize, const LE: usize> SafeCursor<R, 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§

impl<'a, E: ContentTraits, I: TreeMetrics<E>, const IE: usize, const LE: usize> SafeCursor<&'a mut ContentTreeRaw<E, I, IE, LE>, 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).

Source§

impl<R, E: ContentTraits + ContentLength, I: FindContent<E>, const IE: usize, const LE: usize> SafeCursor<R, E, I, IE, LE>

Source§

impl<R, E: ContentTraits, I: FindOffset<E>, const IE: usize, const LE: usize> SafeCursor<R, E, I, IE, LE>

Source

pub fn count_offset_pos(&self) -> usize

Source§

impl<R, E: ContentTraits + Searchable, I: TreeMetrics<E>, const IE: usize, const LE: usize> SafeCursor<R, E, I, IE, LE>

Source

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

Trait Implementations§

Source§

impl<R: Clone, E: Clone + ContentTraits, I: Clone + TreeMetrics<E>, const IE: usize, const LE: usize> Clone for SafeCursor<R, E, I, IE, LE>

Source§

fn clone(&self) -> SafeCursor<R, E, I, IE, LE>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<R: Debug, E: Debug + ContentTraits, I: Debug + TreeMetrics<E>, const IE: usize, const LE: usize> Debug for SafeCursor<R, E, I, IE, LE>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<R, E: ContentTraits, I: TreeMetrics<E>, const IE: usize, const LE: usize> From<SafeCursor<R, E, I, IE, LE>> for UnsafeCursor<E, I, IE, LE>

Source§

fn from(c: SafeCursor<R, E, I, IE, LE>) -> Self

Converts to this type from the input type.
Source§

impl<R, E: ContentTraits + Eq, I: TreeMetrics<E>, const IE: usize, const LE: usize> Ord for SafeCursor<R, E, I, IE, LE>

NOTE: This comparator will panic when cursors from different range trees are compared.

Also beware: A cursor pointing to the end of a leaf entry will be considered less than a cursor pointing to the subsequent entry in the next leaf.

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<R, E: ContentTraits, I: TreeMetrics<E>, const IE: usize, const LE: usize> PartialEq for SafeCursor<R, E, I, IE, LE>

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<R, E: ContentTraits + Eq, I: TreeMetrics<E>, const IE: usize, const LE: usize> PartialOrd for SafeCursor<R, E, I, IE, LE>

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<R, E: ContentTraits, I: TreeMetrics<E>, const IE: usize, const LE: usize> Eq for SafeCursor<R, E, I, IE, LE>

Auto Trait Implementations§

§

impl<R, E, I, const IE: usize, const LE: usize> Freeze for SafeCursor<R, E, I, IE, LE>

§

impl<R, E, I, const IE: usize, const LE: usize> RefUnwindSafe for SafeCursor<R, E, I, IE, LE>

§

impl<R, E, I, const IE: usize = DEFAULT_IE, const LE: usize = DEFAULT_LE> !Send for SafeCursor<R, E, I, IE, LE>

§

impl<R, E, I, const IE: usize = DEFAULT_IE, const LE: usize = DEFAULT_LE> !Sync for SafeCursor<R, E, I, IE, LE>

§

impl<R, E, I, const IE: usize, const LE: usize> Unpin for SafeCursor<R, E, I, IE, LE>
where R: Unpin,

§

impl<R, E, I, const IE: usize, const LE: usize> UnwindSafe for SafeCursor<R, E, I, IE, LE>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<I> IntoIterator for I
where I: Iterator,

Source§

type Item = <I as Iterator>::Item

The type of the elements being iterated over.
Source§

type IntoIter = I

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> I

Creates an iterator from a value. Read more
Source§

impl<X, I> MergeableIterator<X> for I
where I: Iterator<Item = X>, X: MergableSpan,

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<Iter, Item> TakeMaxFns<Item> for Iter
where Iter: Iterator<Item = Item>, Item: SplitableSpanCtx + HasLength,

Source§

fn take_max(self) -> TakeMaxIter<Self, I>

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.