pub trait Parser {
// Required methods
fn from_reader<R: BufRead>(reader: R) -> Result<Self, Error>
where Self: Sized;
fn to_writer<W: Write>(&self, writer: W) -> Result<(), Error>;
// Provided methods
fn read_from<P: AsRef<Path>>(path: P) -> Result<Self, Error>
where Self: Sized { ... }
fn write_to<P: AsRef<Path>>(&self, path: P) -> Result<(), Error> { ... }
fn from_str(s: &str) -> Result<Self, Error>
where Self: Sized { ... }
fn from_bytes(bytes: &[u8]) -> Result<Self, Error>
where Self: Sized { ... }
}Expand description
A trait for parsing and writing localization resources from/to one file.
§Example
use langcodec::traits::Parser;
let format = langcodec::formats::strings::Format::read_from("en.strings")?;
format.write_to("en_copy.strings")?;
Ok::<(), Box<dyn std::error::Error>>(())Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.