pub struct Archive<'a, W>where
W: Write + Seek,{ /* private fields */ }Implementations§
source§impl<'a, W> Archive<'a, W>where
W: Write + Seek,
impl<'a, W> Archive<'a, W>where W: Write + Seek,
pub fn new( writer: W, compressor: Box<dyn Compress + 'a>, compression_type: Compression ) -> Result<Self>
sourcepub fn add_path<P: AsRef<Path>>(
&mut self,
path: &OsStr,
file_path: P
) -> Result<()>
pub fn add_path<P: AsRef<Path>>( &mut self, path: &OsStr, file_path: P ) -> Result<()>
add a path record
path will be stored in the archive directly,
while file_path is the actual path of the file to be added
For example, now we are at the location ‘/tmp’, and if we do
tar -C /home -c user > ./tar
the stored paths in this tarball will like this:
- user/a.txt
- user/b.txt
- …
But they’re not relative to our current location ‘/tmp’, so we also need paths to these files to be added, just using absolute paths:
- /home/user/a.txt
- /home/user/b.txt
- …
like tar utility
pub fn set_info(&mut self, info: &Info)
pub fn write(&mut self) -> Result<()>
pub fn flush(&mut self) -> Result<()>
Trait Implementations§
Auto Trait Implementations§
impl<'a, W> !RefUnwindSafe for Archive<'a, W>
impl<'a, W> !Send for Archive<'a, W>
impl<'a, W> !Sync for Archive<'a, W>
impl<'a, W> Unpin for Archive<'a, W>where W: Unpin,
impl<'a, W> !UnwindSafe for Archive<'a, W>
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> 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>where
F: FnOnce(&Self) -> bool,
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>where F: FnOnce(&Self) -> bool,
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