Struct content_tree::UnsafeCursor [−][src]
pub struct UnsafeCursor<E: ContentTraits, I: TreeIndex<E>, const IE: usize, const LE: usize> {
pub offset: usize,
// some fields omitted
}Expand description
A cursor into some location in a range tree.
Note the state of a cursor is weird in two situations:
- When a cursor points to a location in between two entries, the cursor could either point to the end of the first entry or the start of the subsequent entry.
- When a tree is empty, the cursor points past the end of the tree.
Safety: This is unsafe because there’s no associated lifetime on a cursor (its ’static).
The caller must ensure any reads and mutations through an UnsafeCursor are valid WRT the mutability and lifetime of the implicitly referenced content tree. Use Cursor and MutCursor.
Fields
offset: usizeImplementations
impl<E: ContentTraits, I: TreeIndex<E>, const IE: usize, const LE: usize> UnsafeCursor<E, I, IE, LE>
impl<E: ContentTraits, I: TreeIndex<E>, const IE: usize, const LE: usize> UnsafeCursor<E, I, IE, LE>
Internal method for prev_entry and next_entry when we need to move laterally. This moves the cursor to the next / prev node in the tree, with no regard for the current position.
Returns true if the move was successful, or false if we’re at the first / last item in the tree.
Move back to the previous entry. Returns true if it exists, otherwise returns false if we’re at the start of the doc already.
Go to the next entry marker and update the (optional) flush marker. Returns true if successful, or false if we’ve reached the end of the document.
Note this ignores the cursor’s offset.
This is a terrible name. This method modifies a cursor at the end of an entry to be a cursor to the start of the next entry - potentially in the following leaf.
Returns false if the resulting cursor location points past the end of the tree.
This helper method attempts to minimize the size of the leaf around the cursor using append() methods, when possible.
impl<E: ContentTraits + Searchable, I: TreeIndex<E>, const IE: usize, const LE: usize> UnsafeCursor<E, I, IE, LE>
impl<E: ContentTraits + Searchable, I: TreeIndex<E>, const IE: usize, const LE: usize> UnsafeCursor<E, I, IE, LE>
impl<E: ContentTraits + ContentLength, I: FindContent<E>, const IE: usize, const LE: usize> UnsafeCursor<E, I, IE, LE>
impl<E: ContentTraits + ContentLength, I: FindContent<E>, const IE: usize, const LE: usize> UnsafeCursor<E, I, IE, LE>
impl<E: ContentTraits, I: FindOffset<E>, const IE: usize, const LE: usize> UnsafeCursor<E, I, IE, LE>
impl<E: ContentTraits, I: FindOffset<E>, const IE: usize, const LE: usize> UnsafeCursor<E, I, IE, LE>
Trait Implementations
impl<E: Clone + ContentTraits, I: Clone + TreeIndex<E>, const IE: usize, const LE: usize> Clone for UnsafeCursor<E, I, IE, LE>
impl<E: Clone + ContentTraits, I: Clone + TreeIndex<E>, const IE: usize, const LE: usize> Clone for UnsafeCursor<E, I, IE, LE>
impl<E: Debug + ContentTraits, I: Debug + TreeIndex<E>, const IE: usize, const LE: usize> Debug for UnsafeCursor<E, I, IE, LE>
impl<E: Debug + ContentTraits, I: Debug + TreeIndex<E>, const IE: usize, const LE: usize> Debug for UnsafeCursor<E, I, IE, LE>
impl<E: ContentTraits + Eq, I: TreeIndex<E>, const IE: usize, const LE: usize> Ord for UnsafeCursor<E, I, IE, LE>
impl<E: ContentTraits + Eq, I: TreeIndex<E>, const IE: usize, const LE: usize> Ord for UnsafeCursor<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 an entry will be considered less than a cursor pointing to the subsequent entry.
impl<E: PartialEq + ContentTraits, I: PartialEq + TreeIndex<E>, const IE: usize, const LE: usize> PartialEq<UnsafeCursor<E, I, IE, LE>> for UnsafeCursor<E, I, IE, LE>
impl<E: PartialEq + ContentTraits, I: PartialEq + TreeIndex<E>, const IE: usize, const LE: usize> PartialEq<UnsafeCursor<E, I, IE, LE>> for UnsafeCursor<E, I, IE, LE>
This method tests for self and other values to be equal, and is used
by ==. Read more
This method tests for !=.
impl<E: ContentTraits + Eq, I: TreeIndex<E>, const IE: usize, const LE: usize> PartialOrd<UnsafeCursor<E, I, IE, LE>> for UnsafeCursor<E, I, IE, LE>
impl<E: ContentTraits + Eq, I: TreeIndex<E>, const IE: usize, const LE: usize> PartialOrd<UnsafeCursor<E, I, IE, LE>> for UnsafeCursor<E, I, IE, LE>
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
impl<E: Eq + ContentTraits, I: Eq + TreeIndex<E>, const IE: usize, const LE: usize> Eq for UnsafeCursor<E, I, IE, LE>
impl<E: ContentTraits, I: TreeIndex<E>, const IE: usize, const LE: usize> StructuralEq for UnsafeCursor<E, I, IE, LE>
impl<E: ContentTraits, I: TreeIndex<E>, const IE: usize, const LE: usize> StructuralPartialEq for UnsafeCursor<E, I, IE, LE>
Auto Trait Implementations
impl<E, I, const IE: usize, const LE: usize> RefUnwindSafe for UnsafeCursor<E, I, IE, LE> where
E: RefUnwindSafe,
<I as TreeIndex<E>>::IndexValue: RefUnwindSafe,
impl<E, I, const IE: usize, const LE: usize> !Send for UnsafeCursor<E, I, IE, LE>
impl<E, I, const IE: usize, const LE: usize> !Sync for UnsafeCursor<E, I, IE, LE>
impl<E, I, const IE: usize, const LE: usize> Unpin for UnsafeCursor<E, I, IE, LE>
impl<E, I, const IE: usize, const LE: usize> UnwindSafe for UnsafeCursor<E, I, IE, LE> where
E: RefUnwindSafe,
<I as TreeIndex<E>>::IndexValue: RefUnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more