pub struct Unsquashfs { /* private fields */ }
Implementations§
Source§impl Unsquashfs
impl Unsquashfs
Sourcepub fn new() -> Self
pub fn new() -> Self
Examples found in repository?
examples/a.rs (line 6)
5fn main() {
6 let unsquashfs = Unsquashfs::new();
7 let uc = unsquashfs.clone();
8
9 let t = thread::spawn(move || {
10 unsquashfs
11 .extract(
12 "/home/saki/aosc-os_base_20240916_amd64.squashfs",
13 "/test",
14 None,
15 Box::new(move |c| {
16 dbg!(c);
17 }),
18 )
19 });
20
21 thread::sleep(Duration::from_secs(1));
22 uc.cancel().unwrap();
23
24 t.join().unwrap().unwrap();
25}
Sourcepub fn cancel(&self) -> Result<(), UnsquashfsError>
pub fn cancel(&self) -> Result<(), UnsquashfsError>
Examples found in repository?
examples/a.rs (line 22)
5fn main() {
6 let unsquashfs = Unsquashfs::new();
7 let uc = unsquashfs.clone();
8
9 let t = thread::spawn(move || {
10 unsquashfs
11 .extract(
12 "/home/saki/aosc-os_base_20240916_amd64.squashfs",
13 "/test",
14 None,
15 Box::new(move |c| {
16 dbg!(c);
17 }),
18 )
19 });
20
21 thread::sleep(Duration::from_secs(1));
22 uc.cancel().unwrap();
23
24 t.join().unwrap().unwrap();
25}
Sourcepub fn extract(
&self,
archive: impl AsRef<Path>,
directory: impl AsRef<Path>,
thread: Option<usize>,
callback: impl FnMut(i32),
) -> Result<(), UnsquashfsError>
pub fn extract( &self, archive: impl AsRef<Path>, directory: impl AsRef<Path>, thread: Option<usize>, callback: impl FnMut(i32), ) -> Result<(), UnsquashfsError>
Extracts an image using either unsquashfs.
Examples found in repository?
examples/a.rs (lines 11-18)
5fn main() {
6 let unsquashfs = Unsquashfs::new();
7 let uc = unsquashfs.clone();
8
9 let t = thread::spawn(move || {
10 unsquashfs
11 .extract(
12 "/home/saki/aosc-os_base_20240916_amd64.squashfs",
13 "/test",
14 None,
15 Box::new(move |c| {
16 dbg!(c);
17 }),
18 )
19 });
20
21 thread::sleep(Duration::from_secs(1));
22 uc.cancel().unwrap();
23
24 t.join().unwrap().unwrap();
25}
Trait Implementations§
Source§impl Clone for Unsquashfs
impl Clone for Unsquashfs
Source§fn clone(&self) -> Unsquashfs
fn clone(&self) -> Unsquashfs
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for Unsquashfs
impl RefUnwindSafe for Unsquashfs
impl Send for Unsquashfs
impl Sync for Unsquashfs
impl Unpin for Unsquashfs
impl UnwindSafe for Unsquashfs
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more