pub enum Header {
File(File),
Directory {
files: HashMap<String, Self>,
},
Link {
link: PathBuf,
},
}
Expand description
The Header
represents the data structure found in asar archives. It can
either be a File
, or a Directory containing other Header
s.
It is a recursive structure, and a massive pain in the ass as a result. You
really don’t want to manually mess with these — use
AsarReader
instead.
Variants§
Implementations§
source§impl Header
impl Header
sourcepub fn read<Read: ReadBytesExt>(data: &mut Read) -> Result<(Self, usize)>
pub fn read<Read: ReadBytesExt>(data: &mut Read) -> Result<(Self, usize)>
Reads the header from a reader.
Example
use asar::Header;
use std::fs;
let asar_file = fs::read("archive.asar")?;
let (header, offset) = Header::read(&mut &asar_file[..])?;
println!("Header ends at offset {offset}");
println!("Header: {header:#?}");
Trait Implementations§
source§impl<'de> Deserialize<'de> for Header
impl<'de> Deserialize<'de> for Header
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq for Header
impl PartialEq for Header
impl Eq for Header
impl StructuralEq for Header
impl StructuralPartialEq for Header
Auto Trait Implementations§
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin for Header
impl UnwindSafe for Header
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