pub trait Cursor {
type Key<'a>: Copy + Clone + Ord;
type Val<'a>: Copy + Clone + Ord;
type Time: Timestamp + Lattice + Ord + Clone;
type TimeGat<'a>: Copy + IntoOwned<'a, Owned = Self::Time>;
type Diff: Semigroup + 'static;
type DiffGat<'a>: Copy + IntoOwned<'a, Owned = Self::Diff>;
type Storage;
Show 14 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 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 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 to_vec<K, V>(
&mut self,
storage: &Self::Storage,
) -> Vec<((K, V), Vec<(Self::Time, Self::Diff)>)>
where for<'a> Self::Key<'a>: IntoOwned<'a, Owned = K>,
for<'a> Self::Val<'a>: IntoOwned<'a, Owned = V> { ... }
}
Expand description
A cursor for navigating ordered (key, val, time, diff)
updates.
Required Associated Types§
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 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 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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.