Struct fuchsia_zbi::ZbiParser

source ·
pub struct ZbiParser { /* private fields */ }

Implementations§

source§

impl ZbiParser

source

pub fn align_zbi_item(length: u32) -> Result<u32, ZbiParserError>

source

pub fn new(vmo: Vmo) -> ZbiParser

source

pub fn set_store_item(self, zbi_type: ZbiType) -> Self

Set a ZBI item type as should be stored. If no item types are set to store, then all known items are stored.

source

pub fn try_get_item( &self, zbi_type_raw: u32, extra: Option<u32>, ) -> Result<Vec<ZbiResult>, ZbiParserError>

Try and get one stored item type, optionally restricted by the item’s extra. The raw type is passed to allow differentiating between different types of driver metadata.

source

pub fn try_get_last_matching_item( &self, zbi_type_raw: u32, extra: u32, ) -> Result<ZbiResult, ZbiParserError>

Helper function to return the last item matching a given type and extra value. This avoids reading unwanted results from the underlying VMO. The raw type is passed to allow differentiating between different types of driver metadata.

source

pub fn get_items( &self, ) -> Result<HashMap<ZbiType, Vec<ZbiResult>>, ZbiParserError>

Get all stored ZBI items.

source

pub fn release_item(&mut self, zbi_type: ZbiType) -> Result<(), ZbiParserError>

Release an item type, zeroing the VMO memory and decommitting the pages if possible.

source

pub fn parse(self) -> Result<Self, ZbiParserError>

Parse a ZBI VMO, storing the offset for each item. If set_store_item was used, only those item types will be stored, and the other item types will be zeroed and decommitted.

Trait Implementations§

source§

impl Debug for ZbiParser

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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>,

§

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>,

§

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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more