ControlTarReader

Struct ControlTarReader 

Source
pub struct ControlTarReader { /* private fields */ }
Expand description

A reader for control.tar files.

Implementations§

Source§

impl ControlTarReader

Source

pub fn entries(&mut self) -> Result<ControlTarEntries<'_>>

Obtain the entries in the control.tar file.

This can only be called once, immediately after the reader/archive is opened. It is a glorified wrapper around tar::Archive::entries() and has the same semantics.

Methods from Deref<Target = Archive<Box<dyn Read>>>§

Source

pub fn entries(&mut self) -> Result<Entries<'_, R>, Error>

Construct an iterator over the entries in this archive.

Note that care must be taken to consider each entry within an archive in sequence. If entries are processed out of sequence (from what the iterator returns), then the contents read for each entry may be corrupted.

Source

pub fn unpack<P>(&mut self, dst: P) -> Result<(), Error>
where P: AsRef<Path>,

Unpacks the contents tarball into the specified dst.

This function will iterate over the entire contents of this tarball, extracting each file in turn to the location specified by the entry’s path name.

This operation is relatively sensitive in that it will not write files outside of the path specified by dst. Files in the archive which have a ‘..’ in their path are skipped during the unpacking process.

§Examples
use std::fs::File;
use tar::Archive;

let mut ar = Archive::new(File::open("foo.tar").unwrap());
ar.unpack("foo").unwrap();
Source

pub fn set_mask(&mut self, mask: u32)

Set the mask of the permission bits when unpacking this entry.

The mask will be inverted when applying against a mode, similar to how umask works on Unix. In logical notation it looks like:

new_mode = old_mode & (~mask)

The mask is 0 by default and is currently only implemented on Unix.

Source

pub fn set_unpack_xattrs(&mut self, unpack_xattrs: bool)

Indicate whether extended file attributes (xattrs on Unix) are preserved when unpacking this archive.

This flag is disabled by default and is currently only implemented on Unix using xattr support. This may eventually be implemented for Windows, however, if other archive implementations are found which do this as well.

Source

pub fn set_preserve_permissions(&mut self, preserve: bool)

Indicate whether extended permissions (like suid on Unix) are preserved when unpacking this entry.

This flag is disabled by default and is currently only implemented on Unix.

Source

pub fn set_preserve_ownerships(&mut self, preserve: bool)

Indicate whether numeric ownership ids (like uid and gid on Unix) are preserved when unpacking this entry.

This flag is disabled by default and is currently only implemented on Unix.

Source

pub fn set_overwrite(&mut self, overwrite: bool)

Indicate whether files and symlinks should be overwritten on extraction.

Source

pub fn set_preserve_mtime(&mut self, preserve: bool)

Indicate whether access time information is preserved when unpacking this entry.

This flag is enabled by default.

Source

pub fn set_ignore_zeros(&mut self, ignore_zeros: bool)

Ignore zeroed headers, which would otherwise indicate to the archive that it has no more entries.

This can be used in case multiple tar archives have been concatenated together.

Source

pub fn entries_with_seek(&mut self) -> Result<Entries<'_, R>, Error>

Construct an iterator over the entries in this archive for a seekable reader. Seek will be used to efficiently skip over file contents.

Note that care must be taken to consider each entry within an archive in sequence. If entries are processed out of sequence (from what the iterator returns), then the contents read for each entry may be corrupted.

Trait Implementations§

Source§

impl Deref for ControlTarReader

Source§

type Target = Archive<Box<dyn Read>>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for ControlTarReader

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

Auto Trait Implementations§

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

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more