Struct loe::Config

source · []
pub struct Config<E: Into<Box<dyn EncodingChecker>>, T: Into<Box<dyn Transform>>> { /* private fields */ }
Expand description

Configuration for processing. Two things can be set: encoding of input and type of line ending.

use std::io::Cursor;

use loe::{process, Config, Encoding, TransformMode};

let mut input = Cursor::new("hello\nworld!\n");
let expected = "hello\r\nworld!\r\n";
let mut output = Cursor::new(Vec::new());

process(&mut input, &mut output, Config::default().encoding(Encoding::Ascii).transform(TransformMode::Crlf));
let actual = String::from_utf8(output.into_inner()).unwrap();
assert_eq!(actual, expected);

Implementations

Creates default instance of the config (no encoding, UTF-8).

Changes the encoding. Given value must be a type which implements Into<Box>. For more info, see documentation for EncodingChecker.

Changes the transformation. Given value must be a type which implements Into<Box>. For more info, see documentation for Transform.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.