Save

Struct Save 

Source
pub struct Save<R> { /* private fields */ }
Expand description

File writer

Implementations§

Source§

impl<R> Save<R>

Source

pub const fn create_dest_path(self, flag: bool) -> Self

Create destination directory when it doesn’t exists

Default: true

Source

pub const fn force_overwrite(self, flag: bool) -> Self

Overwrite existing file

Default: true

Source

pub const fn fix_invalid_dest(self, flag: bool) -> Self

Try to fix destination path when it is not a valid

For example, when destination already exists and it is a directory, it will be removed

Default: true

Source

pub const fn cleanup_on_error(self, flag: bool) -> Self

Cleanup already written data when errors occurs

Default: true

Source§

impl<R> Save<R>

Source

pub fn to<D>(self, path: D) -> Status
where R: Read, D: AsRef<Path>,

Save file to specified path

§Errors
  • Destination directory does not exists when create_dest_path is not set
  • File already exist at destination directory when force_overwrite is not set
  • Destination path is not a file when fix_invalid_dest is not set

Trait Implementations§

Source§

impl<R> From<Result<R, Error>> for Save<R>

Source§

fn from(source: Result<R>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<R> Freeze for Save<R>
where R: Freeze,

§

impl<R> !RefUnwindSafe for Save<R>

§

impl<R> Send for Save<R>
where R: Send,

§

impl<R> Sync for Save<R>
where R: Sync,

§

impl<R> Unpin for Save<R>
where R: Unpin,

§

impl<R> !UnwindSafe for Save<R>

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, 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.
Source§

impl<T> ErasedDestructor for T
where T: 'static,