Skip to main content

TarRegularFile

Struct TarRegularFile 

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

Regular-file metadata paired with a reader for its payload bytes.

Values of this type are yielded by TarReader and can also be built manually for TarWriter. The type implements AsyncRead so callers can stream file contents.

Implementations§

Source§

impl<'a, R: AsyncRead + 'a> TarRegularFile<'a, R>

Source

pub fn new<N: Into<Box<str>>>( path_name: N, size: u64, inner: R, ) -> TarRegularFile<'a, R>

Build a regular-file entry with the provided body reader.

size must match the exact number of bytes that inner will yield.

Source

pub fn size(&self) -> u64

Return the size stored in the tar header.

Source

pub fn path(&self) -> &str

Return the path stored for this entry.

Source

pub fn mode(&self) -> u32

Return the raw permission bits stored in the tar header.

Source

pub fn mtime(&self) -> SystemTime

Return the modification time stored for this entry.

Source

pub fn atime(&self) -> Option<SystemTime>

Return the access time stored for this entry, if present.

Source

pub fn ctime(&self) -> Option<SystemTime>

Return the status-change time stored for this entry, if present.

Source

pub fn uid(&self) -> u32

Return the raw user id stored in the tar header.

Source

pub fn uname(&self) -> &str

Return the symbolic user name stored in the tar header, if present.

Source

pub fn with_uid(self, uid: u32) -> Self

Replace the raw user id stored in the tar header.

Source

pub fn with_uname<S: Into<Box<str>>>(self, name: S) -> Self

Replace the symbolic user name stored in the tar header.

Source

pub fn gid(&self) -> u32

Return the raw group id stored in the tar header.

Source

pub fn gname(&self) -> &str

Return the symbolic group name stored in the tar header, if present.

Source

pub fn with_gid(self, gid: u32) -> Self

Replace the raw group id stored in the tar header.

Source

pub fn with_gname<S: Into<Box<str>>>(self, name: S) -> Self

Replace the symbolic group name stored in the tar header.

Source

pub fn with_mode(self, mode: u32) -> Self

Replace the raw permission bits stored in the tar header.

Source

pub fn with_mtime(self, mtime: SystemTime) -> Self

Replace the modification time stored for this entry.

Source

pub fn with_atime(self, atime: SystemTime) -> Self

Replace the access time stored for this entry.

Source

pub fn with_ctime(self, ctime: SystemTime) -> Self

Replace the status-change time stored for this entry.

Source

pub fn attrs(&self) -> &AttrList

Return the extended attributes that will be encoded in PAX records.

Source

pub fn attrs_mut(&mut self) -> &mut AttrList

Return a mutable reference to the extended attributes.

Source

pub fn with_attrs(self, attrs: AttrList) -> Self

Replace the extended-attribute list and return the updated entry.

Trait Implementations§

Source§

impl<'a, R: AsyncRead + 'a> AsyncRead for TarRegularFile<'a, R>

Available on crate feature smol only.
Source§

fn poll_read( self: Pin<&mut Self>, ctx: &mut Context<'_>, buf: &mut [u8], ) -> Poll<Result<usize>>

Attempt to read from the AsyncRead into buf. Read more
Source§

fn poll_read_vectored( self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &mut [IoSliceMut<'_>], ) -> Poll<Result<usize, Error>>

Attempt to read from the AsyncRead into bufs using vectored IO operations. Read more
Source§

impl<'a, R: AsyncRead + 'a> From<TarRegularFile<'a, R>> for TarEntry<'a, R>

Source§

fn from(file: TarRegularFile<'a, R>) -> Self

Converts to this type from the input type.
Source§

impl<'__pin, 'a, R> Unpin for TarRegularFile<'a, R>
where PinnedFieldsOf<__Origin<'__pin, 'a, R>>: Unpin,

Auto Trait Implementations§

§

impl<'a, R> Freeze for TarRegularFile<'a, R>
where R: Freeze,

§

impl<'a, R> RefUnwindSafe for TarRegularFile<'a, R>
where R: RefUnwindSafe,

§

impl<'a, R> Send for TarRegularFile<'a, R>
where R: Send,

§

impl<'a, R> Sync for TarRegularFile<'a, R>
where R: Sync,

§

impl<'a, R> UnsafeUnpin for TarRegularFile<'a, R>
where R: UnsafeUnpin,

§

impl<'a, R> UnwindSafe for TarRegularFile<'a, R>
where R: 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<R> AsyncReadExt for R
where R: AsyncRead + ?Sized,

Source§

fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> ReadFuture<'a, Self>
where Self: Unpin,

Reads some bytes from the byte stream. Read more
Source§

fn read_vectored<'a>( &'a mut self, bufs: &'a mut [IoSliceMut<'a>], ) -> ReadVectoredFuture<'a, Self>
where Self: Unpin,

Like read(), except it reads into a slice of buffers. Read more
Source§

fn read_to_end<'a>( &'a mut self, buf: &'a mut Vec<u8>, ) -> ReadToEndFuture<'a, Self>
where Self: Unpin,

Reads the entire contents and appends them to a Vec. Read more
Source§

fn read_to_string<'a>( &'a mut self, buf: &'a mut String, ) -> ReadToStringFuture<'a, Self>
where Self: Unpin,

Reads the entire contents and appends them to a String. Read more
Source§

fn read_exact<'a>(&'a mut self, buf: &'a mut [u8]) -> ReadExactFuture<'a, Self>
where Self: Unpin,

Reads the exact number of bytes required to fill buf. Read more
Source§

fn take(self, limit: u64) -> Take<Self>
where Self: Sized,

Creates an adapter which will read at most limit bytes from it. Read more
Source§

fn bytes(self) -> Bytes<Self>
where Self: Sized,

Converts this AsyncRead into a Stream of bytes. Read more
Source§

fn chain<R>(self, next: R) -> Chain<Self, R>
where R: AsyncRead, Self: Sized,

Creates an adapter which will chain this stream with another. Read more
Source§

fn boxed_reader<'a>(self) -> Pin<Box<dyn AsyncRead + Send + 'a>>
where Self: Sized + Send + 'a,

Boxes the reader and changes its type to dyn AsyncRead + Send + 'a. Read more
Source§

impl<R> AsyncReadExt for R
where R: AsyncRead + ?Sized,

Source§

fn chain<R>(self, next: R) -> Chain<Self, R>
where Self: Sized, R: AsyncRead,

Creates an adaptor which will chain this stream with another. Read more
Source§

fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> Read<'a, Self>
where Self: Unpin,

Tries to read some bytes directly into the given buf in asynchronous manner, returning a future type. Read more
Source§

fn read_vectored<'a>( &'a mut self, bufs: &'a mut [IoSliceMut<'a>], ) -> ReadVectored<'a, Self>
where Self: Unpin,

Creates a future which will read from the AsyncRead into bufs using vectored IO operations. Read more
Source§

fn read_exact<'a>(&'a mut self, buf: &'a mut [u8]) -> ReadExact<'a, Self>
where Self: Unpin,

Creates a future which will read exactly enough bytes to fill buf, returning an error if end of file (EOF) is hit sooner. Read more
Source§

fn read_to_end<'a>(&'a mut self, buf: &'a mut Vec<u8>) -> ReadToEnd<'a, Self>
where Self: Unpin,

Creates a future which will read all the bytes from this AsyncRead. Read more
Source§

fn read_to_string<'a>( &'a mut self, buf: &'a mut String, ) -> ReadToString<'a, Self>
where Self: Unpin,

Creates a future which will read all the bytes from this AsyncRead. Read more
Source§

fn split(self) -> (ReadHalf<Self>, WriteHalf<Self>)
where Self: Sized + AsyncWrite,

Helper method for splitting this read/write object into two halves. Read more
Source§

fn take(self, limit: u64) -> Take<Self>
where Self: Sized,

Creates an AsyncRead adapter which will read at most limit bytes from the underlying reader. 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, 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.