pub struct SeqData<D = Vec<u8>> { /* private fields */ }Expand description
Sequence-numbered non-marked data.
It is a subset of SeqMarked where data is always normal.
use seq_marked::SeqData;
let v1 = SeqData::new(1, "data");Implementations§
Source§impl<D> SeqData<D>
impl<D> SeqData<D>
Sourcepub fn map<U>(self, f: impl FnOnce(D) -> U) -> SeqData<U>
pub fn map<U>(self, f: impl FnOnce(D) -> U) -> SeqData<U>
Transforms data D to U while preserving sequence and tombstone state.
§Example
use seq_marked::SeqData;
let a = SeqData::new(1, "data");
let b = a.map(|x| x.len());
assert_eq!(b.data(), &4);pub fn try_map<U, E>( self, f: impl FnOnce(D) -> Result<U, E>, ) -> Result<SeqData<U>, E>
Sourcepub fn order_key(&self) -> SeqMarked<()>
pub fn order_key(&self) -> SeqMarked<()>
Returns ordering key (sequence + tombstone state only).
Sourcepub fn internal_seq(&self) -> InternalSeq
pub fn internal_seq(&self) -> InternalSeq
Returns the sequence number for internal use, tombstone also has a seq.
Sourcepub fn user_seq(&self) -> u64
pub fn user_seq(&self) -> u64
Returns the sequence number for application use, tombstone always has seq 0.
pub fn into_parts(self) -> (u64, D)
Sourcepub fn display_with_debug(&self) -> impl Display + '_where
D: Debug,
pub fn display_with_debug(&self) -> impl Display + '_where
D: Debug,
Returns formatter for display using Debug trait.
Trait Implementations§
Source§impl<D: Ord> Ord for SeqData<D>
impl<D: Ord> Ord for SeqData<D>
1.21.0 · 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<D: PartialOrd> PartialOrd for SeqData<D>
impl<D: PartialOrd> PartialOrd for SeqData<D>
impl<D: Copy> Copy for SeqData<D>
impl<D: Eq> Eq for SeqData<D>
impl<D> StructuralPartialEq for SeqData<D>
Auto Trait Implementations§
impl<D> Freeze for SeqData<D>where
D: Freeze,
impl<D> RefUnwindSafe for SeqData<D>where
D: RefUnwindSafe,
impl<D> Send for SeqData<D>where
D: Send,
impl<D> Sync for SeqData<D>where
D: Sync,
impl<D> Unpin for SeqData<D>where
D: Unpin,
impl<D> UnwindSafe for SeqData<D>where
D: UnwindSafe,
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