pub trait Cursor {
type Key<'a>: Copy + Clone + MyTrait<'a, Owned = Self::KeyOwned>;
type KeyOwned: Ord + Clone;
type Val<'a>: Copy + Clone + MyTrait<'a, Owned = Self::ValOwned> + for<'b> PartialOrd<Self::Val<'b>>;
type ValOwned: Ord + Clone;
type Time;
type Diff: ?Sized;
type Storage;
Show 15 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::Time, &Self::Diff)>(
&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 seek_key_owned(&mut self, storage: &Self::Storage, key: &Self::KeyOwned) { ... }
fn to_vec(
&mut self,
storage: &Self::Storage,
) -> Vec<((Self::KeyOwned, Self::ValOwned), Vec<(Self::Time, Self::Diff)>)>
where Self::Time: Clone,
Self::Diff: Clone { ... }
}
Expand description
A cursor for navigating ordered (key, val, time, diff)
updates.
Required Associated Types§
Sourcetype Key<'a>: Copy + Clone + MyTrait<'a, Owned = Self::KeyOwned>
type Key<'a>: Copy + Clone + MyTrait<'a, Owned = Self::KeyOwned>
Key by which updates are indexed.
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::Time, &Self::Diff)>(
&mut self,
storage: &Self::Storage,
logic: L,
)
fn map_times<L: FnMut(&Self::Time, &Self::Diff)>( &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.
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 seek_key_owned(&mut self, storage: &Self::Storage, key: &Self::KeyOwned)
fn seek_key_owned(&mut self, storage: &Self::Storage, key: &Self::KeyOwned)
Convenience method to get access by reference to an owned key.
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.