pub struct SeqKey(/* private fields */);Expand description
A validated sequence key: non-empty, valid UTF-8 (guaranteed by String),
and at most MAX_SEQ_KEY_LEN bytes. try_new is the single validation
site — a value of this type is proof the key is in range.
The serde impls are hand-written (not derived) so deserialization routes
through try_new: a derived Deserialize for a newtype builds the inner
String directly and would be a second construction site that bypasses the
invariant. Mirrors crate::peer::PeerEndpoint’s validate-on-deserialize
discipline. Serialize emits the bare string (newtype-transparent), so the
on-disk and wire byte layout is unchanged.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SeqKey
Available on crate feature serde only.
impl<'de> Deserialize<'de> for SeqKey
Available on crate feature
serde only.Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl Eq for SeqKey
Source§impl Ord for SeqKey
impl Ord for SeqKey
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 PartialOrd for SeqKey
impl PartialOrd for SeqKey
impl StructuralPartialEq for SeqKey
Auto Trait Implementations§
impl Freeze for SeqKey
impl RefUnwindSafe for SeqKey
impl Send for SeqKey
impl Sync for SeqKey
impl Unpin for SeqKey
impl UnsafeUnpin for SeqKey
impl UnwindSafe for SeqKey
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