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§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§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)