Skip to main content

Packer

Struct Packer 

Source
pub struct Packer {}

Implementations§

Source§

impl Packer

Source

pub fn new() -> Self

Trait Implementations§

Source§

impl Packing for Packer

Source§

fn set_path( &self, fimg: &mut FileImage, xname: &str, ) -> Result<(), Box<dyn Error>>

Check syntax and set the path for this file image
Source§

fn get_load_address(&self, _fimg: &FileImage) -> usize

Get load address for this file image, if applicable.
Source§

fn pack( &self, fimg: &mut FileImage, dat: &[u8], load_addr: Option<usize>, ) -> Result<(), Box<dyn Error>>

automatically select a packing strategy by analyzing the data
Source§

fn unpack(&self, fimg: &FileImage) -> Result<UnpackedData, Box<dyn Error>>

automatically select an unpacking strategy based on the file image metadata
Source§

fn pack_raw( &self, fimg: &mut FileImage, dat: &[u8], ) -> Result<(), Box<dyn Error>>

Pack raw byte stream into file image. Headers used by the file system are not automatically inserted. If the file system has explicit typing, the type is set to text.
Source§

fn unpack_raw( &self, fimg: &FileImage, trunc: bool, ) -> Result<Vec<u8>, Box<dyn Error>>

Get the raw bytestream, including any header used by the file system. The byte stream will extend to end of block unless trunc==true. Setting trunc==true only works if the EOF is stored in the directory.
Source§

fn pack_bin( &self, fimg: &mut FileImage, dat: &[u8], load_addr: Option<usize>, trailing: Option<&[u8]>, ) -> Result<(), Box<dyn Error>>

Pack bytes into file image, if file system uses a header it is added. The load address will be checked for validity, if not used by FS it must be None.
Source§

fn unpack_bin(&self, fimg: &FileImage) -> Result<Vec<u8>, Box<dyn Error>>

get bytes from file image, if file system uses a header it is stripped
Source§

fn pack_txt( &self, fimg: &mut FileImage, txt: &str, ) -> Result<(), Box<dyn Error>>

Convert UTF8 with either LF or CRLF to the file system’s text format. This returns an error if the conversion would result in any loss of data.
Source§

fn unpack_txt(&self, fimg: &FileImage) -> Result<String, Box<dyn Error>>

Convert the file system’s text format to UTF8 with LF. This always succeeds because the underlying text converters will replace unknown characters with ASCII NULL.
Source§

fn pack_tok( &self, _fimg: &mut FileImage, _tok: &[u8], _lang: ItemType, _trailing: Option<&[u8]>, ) -> Result<(), Box<dyn Error>>

pack language tokens into file image, if file system uses a header it is added
Source§

fn unpack_tok(&self, _fimg: &FileImage) -> Result<Vec<u8>, Box<dyn Error>>

get language tokens from file image, if file system uses a header it is stripped
Source§

fn pack_rec_str( &self, _fimg: &mut FileImage, _json: &str, ) -> Result<(), Box<dyn Error>>

turn JSON representation of random access text into a file image
Source§

fn unpack_rec_str( &self, _fimg: &FileImage, _rec_len: Option<usize>, _indent: Option<u16>, ) -> Result<String, Box<dyn Error>>

turn the file image into JSON representation of random access text
Source§

fn pack_rec( &self, _fimg: &mut FileImage, _recs: &Records, ) -> Result<(), Box<dyn Error>>

turn random access text records into a file image
Source§

fn unpack_rec( &self, _fimg: &FileImage, _rec_len: Option<usize>, ) -> Result<Records, Box<dyn Error>>

turn the file image into random access text records
Source§

fn pack_apple_single( &self, _fimg: &mut FileImage, _dat: &[u8], _load_addr: Option<usize>, ) -> Result<(), Box<dyn Error>>

turn an AppleSingle file image into a native file image
Source§

fn unpack_apple_single( &self, _fimg: &FileImage, ) -> Result<Vec<u8>, Box<dyn Error>>

turn the native file image into an AppleSingle file image

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.