[][src]Trait phollaits::TarBuilderExt

pub trait TarBuilderExt {
    pub fn append_file_directly<P: Into<String>>(
        &mut self,
        path: P
    ) -> Result<()>;
pub fn append_text<F: Into<String>, T: Into<String>>(
        &mut self,
        filename: F,
        text: T
    ) -> Result<()>;
pub fn close_archive(self) -> Result<()>; }

Trait implements some extensions for the Builder-struct of the tar crate.

Required methods

pub fn append_file_directly<P: Into<String>>(&mut self, path: P) -> Result<()>[src]

appends a file to an archive.

Example

extern crate tar;
extern crate phollaits;

use phollaits::*;
use tar::Builder;

fn main() {
	let b = Builder::new("/tmp/archive.tar");
	b.append_file_directly("/home/ph0llux/example01.png"); //appends a file (absoulte path)
	b.append_file_directly("example02.png"); //appends a file (relative path)
	b.close_archive();
}

pub fn append_text<F: Into<String>, T: Into<String>>(
    &mut self,
    filename: F,
    text: T
) -> Result<()>
[src]

appends a text (string) to an archive. The text will be written as a textfile, with the "unix-like" file permissions 644.

Example

extern crate tar;
extern crate phollaits;

use phollaits::*;
use tar::Builder;

fn main() {
	let b = Builder::new("/tmp/archive.tar");
	let content = "this is an example text";
	let filename_in_archive = "/home/ph0llux/example01.txt";
	b.append_text(filename_in_archive, content);
	b.close_archive();
}

pub fn close_archive(self) -> Result<()>[src]

This method simply calls the into_inner() method. This method is used solely for embellishment purposes. you can call the into_inner() method directly.

Loading content...

Implementations on Foreign Types

impl TarBuilderExt for Builder<File>[src]

impl TarBuilderExt for Builder<Box<dyn Write>>[src]

Loading content...

Implementors

Loading content...