[−][src]Struct dmgwiz::DmgWiz
Main type representing a DMG
Use the from_reader
method to parse a DMG from any input stream. Afterwards, partition
information will be available through the partitions
attribute. Either extract_all
or
extract
can be used to retrieve partition data from the image.
See main.rs
for a real-world example.
Fields
partitions: Vec<Partition>
Array of partitions
verbosity: Verbosity
Implementations
impl<R> DmgWiz<R> where
R: Read + Seek,
[src]
R: Read + Seek,
pub fn from_reader(input: R, verbosity: Verbosity) -> Result<DmgWiz<R>>
[src]
Create a DmgWiz
instance from a seekable byte stream
Arguments
input
- A seekable readerverbosity
- Verbosity for debugging
Example
use std::fs::File; use dmgwiz::{DmgWiz, Verbosity}; let input = File::open("tests/input_zlib.dmg").unwrap(); let mut wiz = match DmgWiz::from_reader(input, Verbosity::None) { Err(err) => panic!(format!("could not read input file - {}", err)), Ok(val) => val, };
pub fn extract_all<W>(&mut self, output: W) -> Result<usize> where
W: Write + Seek,
[src]
W: Write + Seek,
Decompress all partitions and write to output
Arguments
output
- A seekable writer
Example
use std::fs::File; use dmgwiz::{DmgWiz, Verbosity}; let input = File::open("tests/input_zlib.dmg").unwrap(); let output = File::create("tests/output_zlib.bin").unwrap(); let mut wiz = DmgWiz::from_reader(input, Verbosity::None).unwrap(); match wiz.extract_all(output) { Err(err) => panic!(format!("error while extracting: {}", err)), Ok(bytes) => println!("done. {} bytes written", bytes), }
pub fn extract_partition<W>(
&mut self,
output: W,
partition_num: usize
) -> Result<usize> where
W: Write,
[src]
&mut self,
output: W,
partition_num: usize
) -> Result<usize> where
W: Write,
Decompress a specific partition and write to output
Partition information can be retrieved using the partitions
attribute of DmzWiz
.
Returns the number of written bytes.
Arguments
output
- A writerpartition_num
- Index of the partition
Example
use std::fs::File; use dmgwiz::{DmgWiz, Verbosity}; let input = File::open("tests/input_zlib.dmg").unwrap(); let output = File::create("tests/output_zlib.bin").unwrap(); let mut wiz = DmgWiz::from_reader(input, Verbosity::None).unwrap(); match wiz.extract_partition(output, 0) { Err(err) => panic!(format!("error while extracting: {}", err)), Ok(bytes) => println!("done. {} bytes written", bytes), }
Auto Trait Implementations
impl<R> RefUnwindSafe for DmgWiz<R> where
R: RefUnwindSafe,
R: RefUnwindSafe,
impl<R> Send for DmgWiz<R> where
R: Send,
R: Send,
impl<R> Sync for DmgWiz<R> where
R: Sync,
R: Sync,
impl<R> Unpin for DmgWiz<R> where
R: Unpin,
R: Unpin,
impl<R> UnwindSafe for DmgWiz<R> where
R: UnwindSafe,
R: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,