Struct DecodeOptions

Source
pub struct DecodeOptions<P> { /* private fields */ }
Expand description

Options for decoding. The entry point for decoding from a file or (TCP) stream to an output directory.

Implementations§

Source§

impl<P> DecodeOptions<P>
where P: AsRef<Path>,

Source

pub fn new(output_dir: P) -> DecodeOptions<P>

Construct new DecodeOptions using the specified path as output directory. The output directory is

Source

pub fn decode_file( &self, input_filename: &str, ) -> Result<Box<Path>, DecodeError>

Decodes the input file in a new output file.

If ok, returns the path of the decoded file.

§Example
let decode_options = yenc::DecodeOptions::new("/tmp/decoded");
decode_options.decode_file("test2.bin.yenc");
§Errors
  • when the output file already exists
  • when I/O error occurs
Source

pub fn decode_stream<R>(&self, read_stream: R) -> Result<Box<Path>, DecodeError>
where R: Read,

Decodes the data from a stream to the specified directory.

Writes the output to a file with the filename from the header line, and places it in the output path. The path of the output file is returned as String.

Trait Implementations§

Source§

impl<P: Debug> Debug for DecodeOptions<P>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<P> Freeze for DecodeOptions<P>
where P: Freeze,

§

impl<P> RefUnwindSafe for DecodeOptions<P>
where P: RefUnwindSafe,

§

impl<P> Send for DecodeOptions<P>
where P: Send,

§

impl<P> Sync for DecodeOptions<P>
where P: Sync,

§

impl<P> Unpin for DecodeOptions<P>
where P: Unpin,

§

impl<P> UnwindSafe for DecodeOptions<P>
where P: 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<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.