Skip to main content

Difference

Struct Difference 

Source
pub struct Difference<A, B> { /* private fields */ }
Expand description

Cursor combinator yielding full ∖ delta: every key from full that is absent from delta. Generic over any two SortedCursors with the same key type — works for SortedVecCursor, BPlusCursor, or nested combinators, with no coupling to a backend. Itself a SortedCursor, so leapfrog consumes it like any other cursor.

Used by semi-naive evaluation to restrict an atom to “old” nodes (full ∖ delta) without materialising a third index.

Invariant: after construction and after every step/seek, the full sub-cursor points at a non-excluded key or is exhausted, so key() just reads full. Relies on leapfrog’s monotonic-forward seeks — the delta sub-cursor only ever advances, never rewinds. Cost is O(|full|+|delta|) across a full scan.

Implementations§

Source§

impl<K, A, B> Difference<A, B>
where K: Copy + Ord, A: SortedCursor<Key = K>, B: SortedCursor<Key = K>,

Source

pub fn new(full: A, delta: B) -> Self

Wrap full and delta, establishing the skip invariant.

Trait Implementations§

Source§

impl<K, A, B> SortedCursor for Difference<A, B>
where K: Copy + Ord, A: SortedCursor<Key = K>, B: SortedCursor<Key = K>,

Source§

type Key = K

Source§

fn key(&self) -> Option<K>

Current key, or None if exhausted.
Source§

fn step(&mut self)

Advance one key. No-op on an exhausted cursor.
Source§

fn seek(&mut self, target: K)

Advance to the first key ≥ target. Exhausts the cursor if no such key exists.

Auto Trait Implementations§

§

impl<A, B> Freeze for Difference<A, B>
where A: Freeze, B: Freeze,

§

impl<A, B> RefUnwindSafe for Difference<A, B>

§

impl<A, B> Send for Difference<A, B>
where A: Send, B: Send,

§

impl<A, B> Sync for Difference<A, B>
where A: Sync, B: Sync,

§

impl<A, B> Unpin for Difference<A, B>
where A: Unpin, B: Unpin,

§

impl<A, B> UnsafeUnpin for Difference<A, B>
where A: UnsafeUnpin, B: UnsafeUnpin,

§

impl<A, B> UnwindSafe for Difference<A, B>
where A: UnwindSafe, B: UnwindSafe,

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.