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>
impl<'a> Unpacker<'a, NoEventHandler>
Sourcepub fn new(reference: Reference<'a>) -> Self
pub fn new(reference: Reference<'a>) -> Self
Create a new unpacker for the given reference.
Sandbox is required by default.
Sourcepub fn event_handler<E: EventHandler>(self, event_handler: E) -> Unpacker<'a, E>
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>
impl<'a, E: EventHandler> Unpacker<'a, E>
Sourcepub fn require_sandbox(self, require_sandbox: bool) -> Self
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.
Sourcepub fn architecture(self, architecture: &'a str) -> Self
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.
Sourcepub fn os(self, os: &'a str) -> Self
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.
Sourcepub fn unpack(self, target: impl AsRef<Path>) -> Result<(), UnpackError>
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.