Enum rshark::Val [] [src]

pub enum Val {
    Signed(i64),
    Unsigned {
        value: u64,
        radix: u8,
    },
    Enum(u64, &'static str),
    String(String),
    Address {
        bytes: Vec<u8>,
        encoded: String,
    },
    Subpacket(Vec<NamedValue>),
    Bytes(Vec<u8>),
    Error(Error),
    Warning(Error),
}

A value parsed from a packet.

TODO

This value type isn't as expressive as would be required for a real Wireshark replacement just yet. Additional needs include:

Variants

Signed

A signed integer, in machine-native representation.

Unsigned

An unsigned integer, in machine-native representation, and a radix (base) for when we display the value to the user (e.g., 0x100 vs 256).

Fields

value
radix
Enum

An integer value that represents a symbolic value.

String

A UTF-8–encoded string.

Address

A network address, which can have its own special encoding.

Fields

bytes
encoded
Subpacket

A set of named values from an encapsulated packet (e.g., TCP within IP).

Bytes

Raw bytes, e.g., a checksum or just unparsed data.

Error

An error that stopped further parsing.

Warning

A problem with a packet that did not stop further parsing (e.g., bad checksum).

Methods

impl Val

fn base2<T>(x: T) -> Result<Val> where T: ToPrimitive + Display

fn base10<T>(x: T) -> Result<Val> where T: ToPrimitive + Display

fn base16<T>(x: T) -> Result<Val> where T: ToPrimitive + Display

fn unsigned<T>(x: T, radix: u8) -> Result<Val> where T: ToPrimitive + Display

fn str<Str>(s: Str) -> Val where Str: Into<String>

fn pretty_print(self, indent_level: usize) -> String

Trait Implementations

Derived Implementations

impl Debug for Val

fn fmt(&self, __arg_0: &mut Formatter) -> Result