Skip to main content

PackageDecoder

Struct PackageDecoder 

Source
pub struct PackageDecoder<'a, TBackend: IoBackend> { /* private fields */ }
Expand description

Represents a BPX Package decoder.

Implementations§

Source§

impl<'a, TBackend: IoBackend> PackageDecoder<'a, TBackend>

Source

pub fn read( decoder: &mut Decoder<TBackend>, ) -> Result<PackageDecoder<'_, TBackend>>

Creates a new PackageDecoder by reading from a BPX decoder.

§Arguments
  • decoder: the BPX Decoder backend to use.

returns: Result<PackageDecoder, Error>

§Errors

An Error is returned if some sections/headers could not be loaded.

§Examples
//TODO: Implement
Source

pub fn get_variant(&self) -> [u8; 2]

Gets the two bytes of BPXP variant.

Source

pub fn get_architecture(&self) -> Architecture

Gets the target CPU Architecture for this BPXP.

Source

pub fn get_platform(&self) -> Platform

Gets the target Platform for this BPXP.

Source

pub fn read_metadata(&mut self) -> Result<Option<Object>>

Reads the metadata section of this BPXP if any. Returns None if there is no metadata in this BPXP.

§Errors

An Error is returned in case of corruption or system error.

§Examples
//TODO: Implement
Source

pub fn read_object_table(&mut self) -> Result<ObjectTable>

Reads the object table of this BPXP.

§Errors

An Error is returned in case of corruption or system error.

§Examples
//TODO: Implement
Source

pub fn get_object_name(&mut self, obj: &ObjectHeader) -> Result<&str>

Gets the name of an object; loads the string if its not yet loaded.

§Arguments
  • obj: the object header to load the actual name for.

returns: Result<&str, Error>

§Errors

An Error is returned if the name could not be read.

§Examples
//TODO: Implement
Source

pub fn unpack_object<TWrite: Write>( &mut self, obj: &ObjectHeader, out: &mut TWrite, ) -> Result<u64>

Unpacks an object to a raw stream. Returns the number of bytes read if the operation has succeeded.

§Arguments
  • obj: the object header.
  • out: the raw Write to use as destination.

returns: Result<u64, Error>

§Errors

An Error is returned if the object could not be unpacked.

§Examples
//TODO: Implement

Auto Trait Implementations§

§

impl<'a, TBackend> Freeze for PackageDecoder<'a, TBackend>

§

impl<'a, TBackend> !RefUnwindSafe for PackageDecoder<'a, TBackend>

§

impl<'a, TBackend> !Send for PackageDecoder<'a, TBackend>

§

impl<'a, TBackend> !Sync for PackageDecoder<'a, TBackend>

§

impl<'a, TBackend> Unpin for PackageDecoder<'a, TBackend>

§

impl<'a, TBackend> UnsafeUnpin for PackageDecoder<'a, TBackend>

§

impl<'a, TBackend> !UnwindSafe for PackageDecoder<'a, TBackend>

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.