[][src]Trait weave::NamingConvention

pub trait NamingConvention {
    fn temp_file(&self) -> Result<(PathBuf, File)>;
fn main_file(&self) -> PathBuf;
fn backup_file(&self) -> PathBuf;
fn is_compressed(&self) -> bool; fn new_temp(&self) -> Result<WriterInfo> { ... } }

A naming convention provides utilities needed to find the involved files, and construct temporary files as part of writing the new weave. The underlying object should keep the path and base name.

The main file is either used by name, or opened for reading. It should never be written to directly. The main file is always compressed if the convention enables compression.

The backup file is only used by name. It is neither written to, nor read. It will be compressed, as it always comes from renaming the main file.

The temporary files are used by name, and written to. They may or may not be compressed, depending on how they will be used.

Required methods

fn temp_file(&self) -> Result<(PathBuf, File)>

Create a temporary file for writing. Upon success, returns the full path of the file, and the opened File for writing to the file. The path should refer to a new file that did not exist prior to this call.

fn main_file(&self) -> PathBuf

Return the pathname of the primary file.

fn backup_file(&self) -> PathBuf

Return the pathname of the backup file.

fn is_compressed(&self) -> bool

Return if compression is requested on main file.

Loading content...

Provided methods

fn new_temp(&self) -> Result<WriterInfo>

Open a possibly compressed temp file, returning a WriterInfo for it. The stream will be buffered, and possibly compressed.

Loading content...

Implementors

impl NamingConvention for SimpleNaming[src]

Loading content...