pub trait Cursor {
type Storage;
type Key<'a>: Copy + Ord;
type ValOwn: Clone + Ord;
type Val<'a>: Copy + Ord;
type Time: Lattice + Timestamp;
type TimeGat<'a>: Copy + Ord;
type Diff: Semigroup + 'static;
type DiffGat<'a>: Copy + Ord;
type KeyContainer: for<'a> BatchContainer<ReadItem<'a> = Self::Key<'a>>;
type ValContainer: for<'a> BatchContainer<ReadItem<'a> = Self::Val<'a>, Owned = Self::ValOwn>;
type TimeContainer: for<'a> BatchContainer<ReadItem<'a> = Self::TimeGat<'a>, Owned = Self::Time>;
type DiffContainer: for<'a> BatchContainer<ReadItem<'a> = Self::DiffGat<'a>, Owned = Self::Diff>;
Show 18 methods
// Required methods
fn key_valid(&self, storage: &Self::Storage) -> bool;
fn val_valid(&self, storage: &Self::Storage) -> bool;
fn key<'a>(&self, storage: &'a Self::Storage) -> Self::Key<'a>;
fn val<'a>(&self, storage: &'a Self::Storage) -> Self::Val<'a>;
fn get_key<'a>(&self, storage: &'a Self::Storage) -> Option<Self::Key<'a>>;
fn get_val<'a>(&self, storage: &'a Self::Storage) -> Option<Self::Val<'a>>;
fn map_times<L: FnMut(Self::TimeGat<'_>, Self::DiffGat<'_>)>(
&mut self,
storage: &Self::Storage,
logic: L,
);
fn step_key(&mut self, storage: &Self::Storage);
fn seek_key(&mut self, storage: &Self::Storage, key: Self::Key<'_>);
fn step_val(&mut self, storage: &Self::Storage);
fn seek_val(&mut self, storage: &Self::Storage, val: Self::Val<'_>);
fn rewind_keys(&mut self, storage: &Self::Storage);
fn rewind_vals(&mut self, storage: &Self::Storage);
// Provided methods
fn owned_val(val: Self::Val<'_>) -> Self::ValOwn { ... }
fn owned_time(time: Self::TimeGat<'_>) -> Self::Time { ... }
fn owned_diff(diff: Self::DiffGat<'_>) -> Self::Diff { ... }
fn clone_time_onto(time: Self::TimeGat<'_>, onto: &mut Self::Time) { ... }
fn to_vec<K, IK, V, IV>(
&mut self,
storage: &Self::Storage,
into_key: IK,
into_val: IV,
) -> Vec<((K, V), Vec<(Self::Time, Self::Diff)>)>
where IK: for<'a> Fn(Self::Key<'a>) -> K,
IV: for<'a> Fn(Self::Val<'a>) -> V { ... }
}Expand description
A cursor for navigating ordered (key, val, time, diff) updates.
Required Associated Types§
Sourcetype KeyContainer: for<'a> BatchContainer<ReadItem<'a> = Self::Key<'a>>
type KeyContainer: for<'a> BatchContainer<ReadItem<'a> = Self::Key<'a>>
Container for update keys.
Sourcetype ValContainer: for<'a> BatchContainer<ReadItem<'a> = Self::Val<'a>, Owned = Self::ValOwn>
type ValContainer: for<'a> BatchContainer<ReadItem<'a> = Self::Val<'a>, Owned = Self::ValOwn>
Container for update vals.
Sourcetype TimeContainer: for<'a> BatchContainer<ReadItem<'a> = Self::TimeGat<'a>, Owned = Self::Time>
type TimeContainer: for<'a> BatchContainer<ReadItem<'a> = Self::TimeGat<'a>, Owned = Self::Time>
Container for times.
Sourcetype DiffContainer: for<'a> BatchContainer<ReadItem<'a> = Self::DiffGat<'a>, Owned = Self::Diff>
type DiffContainer: for<'a> BatchContainer<ReadItem<'a> = Self::DiffGat<'a>, Owned = Self::Diff>
Container for diffs.
Required Methods§
Sourcefn key_valid(&self, storage: &Self::Storage) -> bool
fn key_valid(&self, storage: &Self::Storage) -> bool
Indicates if the current key is valid.
A value of false indicates that the cursor has exhausted all keys.
Sourcefn val_valid(&self, storage: &Self::Storage) -> bool
fn val_valid(&self, storage: &Self::Storage) -> bool
Indicates if the current value is valid.
A value of false indicates that the cursor has exhausted all values for this key.
Sourcefn key<'a>(&self, storage: &'a Self::Storage) -> Self::Key<'a>
fn key<'a>(&self, storage: &'a Self::Storage) -> Self::Key<'a>
A reference to the current key. Asserts if invalid.
Sourcefn val<'a>(&self, storage: &'a Self::Storage) -> Self::Val<'a>
fn val<'a>(&self, storage: &'a Self::Storage) -> Self::Val<'a>
A reference to the current value. Asserts if invalid.
Sourcefn get_key<'a>(&self, storage: &'a Self::Storage) -> Option<Self::Key<'a>>
fn get_key<'a>(&self, storage: &'a Self::Storage) -> Option<Self::Key<'a>>
Returns a reference to the current key, if valid.
Sourcefn get_val<'a>(&self, storage: &'a Self::Storage) -> Option<Self::Val<'a>>
fn get_val<'a>(&self, storage: &'a Self::Storage) -> Option<Self::Val<'a>>
Returns a reference to the current value, if valid.
Sourcefn map_times<L: FnMut(Self::TimeGat<'_>, Self::DiffGat<'_>)>(
&mut self,
storage: &Self::Storage,
logic: L,
)
fn map_times<L: FnMut(Self::TimeGat<'_>, Self::DiffGat<'_>)>( &mut self, storage: &Self::Storage, logic: L, )
Applies logic to each pair of time and difference. Intended for mutation of the
closure’s scope.
Sourcefn seek_key(&mut self, storage: &Self::Storage, key: Self::Key<'_>)
fn seek_key(&mut self, storage: &Self::Storage, key: Self::Key<'_>)
Advances the cursor to the specified key.
Sourcefn seek_val(&mut self, storage: &Self::Storage, val: Self::Val<'_>)
fn seek_val(&mut self, storage: &Self::Storage, val: Self::Val<'_>)
Advances the cursor to the specified value.
Sourcefn rewind_keys(&mut self, storage: &Self::Storage)
fn rewind_keys(&mut self, storage: &Self::Storage)
Rewinds the cursor to the first key.
Sourcefn rewind_vals(&mut self, storage: &Self::Storage)
fn rewind_vals(&mut self, storage: &Self::Storage)
Rewinds the cursor to the first value for current key.
Provided Methods§
Sourcefn owned_time(time: Self::TimeGat<'_>) -> Self::Time
fn owned_time(time: Self::TimeGat<'_>) -> Self::Time
Construct an owned time from a reference.
Sourcefn owned_diff(diff: Self::DiffGat<'_>) -> Self::Diff
fn owned_diff(diff: Self::DiffGat<'_>) -> Self::Diff
Construct an owned diff from a reference.
Sourcefn clone_time_onto(time: Self::TimeGat<'_>, onto: &mut Self::Time)
fn clone_time_onto(time: Self::TimeGat<'_>, onto: &mut Self::Time)
Clones a reference time onto an owned time.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".