pub struct Field {
pub name: Arc<str>,
pub value: Arc<str>,
pub indent: u8,
pub span: (usize, usize),
}Expand description
A field with its name, value, byte span, and indent level.
Fields represent individual pieces of parsed data within a packet. They form a hierarchy with three indent levels:
- Level 0: Packet headers
- Level 1: Top-level fields within a packet
- Level 2: Nested subfields (e.g., signature subpackets)
§Visualization
The span field supports hex dump visualization, allowing UI code
to highlight the corresponding bytes and assign colors as needed.
Fields§
§name: Arc<str>The field name (e.g., “Version”, “Algorithm”, “Creation Time”).
value: Arc<str>The field value as a human-readable string.
indent: u8Indentation level: 0 = packet, 1 = field, 2 = subfield.
span: (usize, usize)Byte range (start, end) in the original data.
Implementations§
Source§impl Field
impl Field
Sourcepub fn new(
name: impl Into<Arc<str>>,
value: impl Into<Arc<str>>,
indent: u8,
span: (usize, usize),
) -> Self
pub fn new( name: impl Into<Arc<str>>, value: impl Into<Arc<str>>, indent: u8, span: (usize, usize), ) -> Self
Creates a new field with all parameters specified.
Sourcepub fn packet(
name: impl Into<Arc<str>>,
value: impl Into<Arc<str>>,
span: (usize, usize),
) -> Self
pub fn packet( name: impl Into<Arc<str>>, value: impl Into<Arc<str>>, span: (usize, usize), ) -> Self
Creates a packet-level field (indent 0).
Used for packet type headers like “Packet: Public Key”.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Field
impl RefUnwindSafe for Field
impl Send for Field
impl Sync for Field
impl Unpin for Field
impl UnsafeUnpin for Field
impl UnwindSafe for Field
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