Skip to main content

Record

Struct Record 

Source
pub struct Record {
    pub header: Header,
    pub data: Vec<u8>,
    pub context: Context,
}
Expand description

A single Crash Log record

Fields§

§header: Header

Header of the record

§data: Vec<u8>

Raw content of the record

§context: Context

Additional information provided to the record

Implementations§

Source§

impl Record

Source

pub fn decode_with_csv( &self, layout: &[u8], offset: usize, ) -> Result<Node, Error>

Decodes a section of the Record located at the given offset into a Node tree using an arbitrary decode definition (layout).

The decode definition must be CSV-encoded, use semi-colons as delimiters, and contain the following columns:

  • name: Dot-separated path to the field in the decode output (example: aaa.bbb.ccc). The path can be relative to the previous entry (example: ..bar.baz).
  • offset: offset of the field in the record in bits.
  • size: size of the field in bits.
  • description: description of the field.
§Examples
use intel_crashlog::prelude::*;

let record = Record {
    header: Header::default(),
    data: vec![0x42],
    ..Record::default()
};

let csv = "name;offset;size;description;bitfield
foo.bar;0;8;;0";

let root = record.decode_with_csv(csv.as_bytes(), 0).unwrap();
let field = root.get_by_path("foo.bar").unwrap();
assert_eq!(field.kind, NodeType::Field { value: 0x42 });
Source

pub fn decode_without_cm(&self) -> Node

Decodes the Record header into a Node tree.

Source

pub fn decode_with_decode_def<T: CollateralTree>( &self, cm: &mut CollateralManager<T>, decode_def: &str, offset: usize, ) -> Result<Node, Error>

Available on crate feature collateral_manager only.

Decodes a section of the Record located at the given offset into a Node tree using an arbitrary decode definition stored in the collateral tree.

Source

pub fn decode<T: CollateralTree>(&self, cm: &mut CollateralManager<T>) -> Node

Available on crate feature collateral_manager only.

Decodes the whole Record into a Node tree using the decode definitions stored in the collateral tree.

Source§

impl Record

Source

pub fn payload(&self) -> &[u8]

Source

pub fn checksum(&self) -> Option<bool>

Trait Implementations§

Source§

impl Default for Record

Source§

fn default() -> Record

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.