pub enum WalkElement {
Single(CBOR),
KeyValue {
key: CBOR,
value: CBOR,
},
}Expand description
Represents an element or element pair during CBOR tree traversal.
This enum allows the visitor to receive either individual CBOR elements or semantic pairs (like map key-value pairs) as a single unit, making pattern matching much more ergonomic.
Variants§
Implementations§
Source§impl WalkElement
impl WalkElement
Sourcepub fn as_single(&self) -> Option<&CBOR>
pub fn as_single(&self) -> Option<&CBOR>
Returns the single CBOR element if this is a Single variant.
Sourcepub fn as_key_value(&self) -> Option<(&CBOR, &CBOR)>
pub fn as_key_value(&self) -> Option<(&CBOR, &CBOR)>
Returns the key-value pair if this is a KeyValue variant.
Sourcepub fn diagnostic_flat(&self) -> String
pub fn diagnostic_flat(&self) -> String
Returns a diagnostic string representation of the element(s).
Trait Implementations§
Source§impl Clone for WalkElement
impl Clone for WalkElement
Source§fn clone(&self) -> WalkElement
fn clone(&self) -> WalkElement
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for WalkElement
impl RefUnwindSafe for WalkElement
impl Send for WalkElement
impl Sync for WalkElement
impl Unpin for WalkElement
impl UnwindSafe for WalkElement
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more