Skip to main content

Module field

Module field 

Source
Expand description

Field trait and implementations for zero-copy field access.

This module provides the abstraction for reading and writing protocol fields directly from/to raw packet buffers at specific offsets.

Structs§

BytesField
A variable-length byte field
FieldDesc
Describes a field’s position and type within a protocol header.
MacAddress
A 6-byte MAC address with display and parsing support.

Enums§

FieldError
Errors that can occur during field operations.
FieldType
Supported field types for dynamic access.
FieldValue
A dynamically-typed field value.

Traits§

Field
Trait for reading/writing protocol fields from raw buffers.

Functions§

read_bits_be
Read arbitrary number of bits from a byte buffer at a bit offset. bit_offset is the starting bit position (0 = MSB of first byte). num_bits is 1..=64. Returns the value right-aligned in a u64.
read_bits_le
Read bits in little-endian bit order (LSB of first byte = bit 0).
read_i8
read_i16_be
read_i32_be
read_i64_be
read_u16_le
read_u24_be
read_u24_le
read_u32_le
read_u64_le
write_bits_be
Write arbitrary number of bits to a byte buffer at a bit offset. bit_offset is the starting bit position (0 = MSB of first byte). num_bits is 1..=64. value is right-aligned.
write_bits_le
Write bits in little-endian bit order (LSB of first byte = bit 0).
write_i8
write_i16_be
write_i32_be
write_i64_be
write_u16_le
write_u24_be
write_u24_le
write_u32_le
write_u64_le