Unpacker

Struct Unpacker 

Source
pub struct Unpacker<'a, E> { /* private fields */ }
Expand description

Download an image and unpack its contents to a new directory.

Implementations§

Source§

impl<'a> Unpacker<'a, NoEventHandler>

Source

pub fn new(reference: Reference<'a>) -> Self

Create a new unpacker for the given reference.

Sandbox is required by default.

Source

pub fn event_handler<E: EventHandler>(self, event_handler: E) -> Unpacker<'a, E>

Set a handler to receive events during the operation.

Source§

impl<'a, E: EventHandler> Unpacker<'a, E>

Source

pub fn require_sandbox(self, require_sandbox: bool) -> Self

Set sandbox requirement.

If require_sandbox is false, the unpacker ignores errors if it can’t create a sandbox to restrict filesystem access.

Source

pub fn architecture(self, architecture: &'a str) -> Self

Set the expected CPU architecture of the image.

If omitted, it uses the architecture currently in use.

Source

pub fn os(self, os: &'a str) -> Self

Set the expected operating system the image.

If omitted, it uses the operating system currently in use.

Source

pub fn unpack(self, target: impl AsRef<Path>) -> Result<(), UnpackError>

Download the image of reference, and unpack its contents to the directory target.

If target exists, it must be empty.

Before unpacking the layers, it tries to create a sandbox to restrict the write access to the target directory. If the sandbox can’t be created, and require_sandbox is true, the process is interrupted.

Auto Trait Implementations§

§

impl<'a, E> Freeze for Unpacker<'a, E>
where E: Freeze,

§

impl<'a, E> RefUnwindSafe for Unpacker<'a, E>
where E: RefUnwindSafe,

§

impl<'a, E> Send for Unpacker<'a, E>
where E: Send,

§

impl<'a, E> Sync for Unpacker<'a, E>
where E: Sync,

§

impl<'a, E> Unpin for Unpacker<'a, E>
where E: Unpin,

§

impl<'a, E> UnwindSafe for Unpacker<'a, E>
where E: UnwindSafe,

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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T