pub struct Cursor<A, L> { /* private fields */ }Expand description
Cursor to track log heights (state vector).
It offers methods to “advance” a log and compute the difference to another state vector. A cursor can be used to manage a state vector over a topic (“log heights” of logs scoped by a topic).
Implementations§
Source§impl<A, L> Cursor<A, L>
impl<A, L> Cursor<A, L>
pub fn new(name: impl AsRef<str>, state: LogHeights<A, L>) -> Self
pub fn name(&self) -> &str
Sourcepub fn state(&self) -> &LogHeights<A, L>
pub fn state(&self) -> &LogHeights<A, L>
Returns state vector.
Sourcepub fn log_height(&self, author: &A, log_id: &L) -> Option<&SeqNum>
pub fn log_height(&self, author: &A, log_id: &L) -> Option<&SeqNum>
Returns state vector for a specific log.
Sourcepub fn compare(&self, other: &LogHeights<A, L>) -> LogRanges<A, L>
pub fn compare(&self, other: &LogHeights<A, L>) -> LogRanges<A, L>
Calculates the difference between two state vectors.
Trait Implementations§
Source§impl<'de, A, L> Deserialize<'de> for Cursor<A, L>
impl<'de, A, L> Deserialize<'de> for Cursor<A, L>
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<A: Ord, L: Ord> Ord for Cursor<A, L>
impl<A: Ord, L: Ord> Ord for Cursor<A, L>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<A: PartialEq, L: PartialEq> PartialEq for Cursor<A, L>
impl<A: PartialEq, L: PartialEq> PartialEq for Cursor<A, L>
Source§impl<A: PartialOrd, L: PartialOrd> PartialOrd for Cursor<A, L>
impl<A: PartialOrd, L: PartialOrd> PartialOrd for Cursor<A, L>
impl<A: Eq, L: Eq> Eq for Cursor<A, L>
impl<A, L> StructuralPartialEq for Cursor<A, L>
Auto Trait Implementations§
impl<A, L> Freeze for Cursor<A, L>
impl<A, L> RefUnwindSafe for Cursor<A, L>where
A: RefUnwindSafe,
L: RefUnwindSafe,
impl<A, L> Send for Cursor<A, L>
impl<A, L> Sync for Cursor<A, L>
impl<A, L> Unpin for Cursor<A, L>
impl<A, L> UnsafeUnpin for Cursor<A, L>
impl<A, L> UnwindSafe for Cursor<A, L>where
A: RefUnwindSafe,
L: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more