pub struct DissectionNode {
pub field: String,
pub label: String,
pub offset: u32,
pub length: u32,
pub children: Vec<DissectionNode>,
}Expand description
One field of a dissected message.
field is a stable machine-readable identifier using dotted paths, e.g.
bgp.header.marker, bgp.update.path_attributes, or bgp.attr.32 (the
attribute type code suffix identifies which path attribute the node
covers). label is a human-readable rendering that frontends can display
directly. Offsets are relative to the start of the dissected buffer: for a
bare BGP message the message itself, and for an MRT record the whole
record (common header + message body).
Best-effort contract: when the input is truncated or malformed, the tree simply stops at the last field that could be walked; a dissector never fails.
Fields§
§field: String§label: String§offset: u32§length: u32§children: Vec<DissectionNode>Implementations§
Source§impl DissectionNode
impl DissectionNode
pub fn new( field: impl Into<String>, label: impl Into<String>, offset: u32, length: u32, ) -> Self
Sourcepub fn find(&self, field: &str) -> Option<&DissectionNode>
pub fn find(&self, field: &str) -> Option<&DissectionNode>
Depth-first search for the first node with an exact field match.
Sourcepub fn find_all<'a>(&'a self, field: &str, out: &mut Vec<&'a DissectionNode>)
pub fn find_all<'a>(&'a self, field: &str, out: &mut Vec<&'a DissectionNode>)
Collect all nodes with an exact field match, in tree order.
Trait Implementations§
Source§impl Clone for DissectionNode
impl Clone for DissectionNode
Source§fn clone(&self) -> DissectionNode
fn clone(&self) -> DissectionNode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DissectionNode
impl Debug for DissectionNode
impl Eq for DissectionNode
Source§impl PartialEq for DissectionNode
impl PartialEq for DissectionNode
impl StructuralPartialEq for DissectionNode
Auto Trait Implementations§
impl Freeze for DissectionNode
impl RefUnwindSafe for DissectionNode
impl Send for DissectionNode
impl Sync for DissectionNode
impl Unpin for DissectionNode
impl UnsafeUnpin for DissectionNode
impl UnwindSafe for DissectionNode
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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