Skip to main content

BinaryData

Struct BinaryData 

Source
pub struct BinaryData {
    pub start: [u8; 2],
    pub data: Vec<u8>,
    /* private fields */
}
Expand description

Structured representation of binary data on disk

Fields§

§start: [u8; 2]§data: Vec<u8>

Implementations§

Source§

impl BinaryData

Source

pub fn pack(bin: &[u8], addr: u16) -> Self

Take unstructured bytes representing the data only (sans header) and pack it into the structure

Trait Implementations§

Source§

impl DiskStruct for BinaryData

Source§

fn new() -> Self

Create an empty structure

Source§

fn from_bytes(dat: &[u8]) -> Result<Self, DiskStructError>

Create structure using flattened bytes (typically from disk)

Source§

fn to_bytes(&self) -> Vec<u8>

Return flattened bytes (typically written to disk)

Source§

fn update_from_bytes(&mut self, dat: &[u8]) -> Result<(), DiskStructError>

Update with flattened bytes (useful mostly as a crutch within a2kit_macro)

Source§

fn len(&self) -> usize

Length of the flattened structure

Source§

fn from_bytes_adv( bytes: &[u8], ptr: &mut usize, ) -> Result<Self, DiskStructError>
where Self: Sized,

convenience function to call from_bytes and increment ptr by len()

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.