pub struct Packer {}Implementations§
Trait Implementations§
Source§impl Packing for Packer
impl Packing for Packer
Source§fn set_path(
&self,
fimg: &mut FileImage,
xname: &str,
) -> Result<(), Box<dyn Error>>
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
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>>
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>>
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>>
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>>
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>>
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>>
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>>
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>>
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>>
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>>
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>>
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>>
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>>
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>>
fn unpack_rec( &self, _fimg: &FileImage, _rec_len: Option<usize>, ) -> Result<Records, Box<dyn Error>>
turn the file image into random access text records
Auto Trait Implementations§
impl Freeze for Packer
impl RefUnwindSafe for Packer
impl Send for Packer
impl Sync for Packer
impl Unpin for Packer
impl UnsafeUnpin for Packer
impl UnwindSafe for Packer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more