pub enum EdgeType {
None,
ArrayElement(usize),
MapKeyValue,
MapKey,
MapValue,
TaggedContent,
}Expand description
The type of incoming edge provided to the visitor.
This enum identifies how a CBOR element is connected to its parent in the hierarchy during traversal. It helps the visitor function understand the semantic relationship between elements.
Each edge type represents a specific relationship within the CBOR structure:
None: Root or no connectionArrayElement: Element is an item in an array (with index)MapKeyValue: A key-value pair from a map (visited as a semantic unit)MapKey: Element is a key in a map (visited individually)MapValue: Element is a value in a map (visited individually)TaggedContent: Element is the content of a tagged value
Variants§
None
No incoming edge (root)
ArrayElement(usize)
Element is an item in an array
MapKeyValue
A key-value pair from a map (visited as a semantic unit)
MapKey
Element is a key in a map (visited individually)
MapValue
Element is a value in a map (visited individually)
TaggedContent
Element is the content of a tagged value
Implementations§
Source§impl EdgeType
Provides a label for the edge type in tree formatting.
impl EdgeType
Provides a label for the edge type in tree formatting.
Sourcepub fn label(&self) -> Option<String>
pub fn label(&self) -> Option<String>
Returns a short text label for the edge type, or None if no label is needed.
This is primarily used for tree formatting to identify relationships between elements.
§Examples
assert_eq!(
EdgeType::ArrayElement(0).label(),
Some("arr[0]".to_string())
);
assert_eq!(EdgeType::MapKeyValue.label(), Some("kv".to_string()));
assert_eq!(EdgeType::MapKey.label(), Some("key".to_string()));
assert_eq!(EdgeType::MapValue.label(), Some("val".to_string()));
assert_eq!(EdgeType::TaggedContent.label(), Some("content".to_string()));
assert_eq!(EdgeType::None.label(), None);