Struct rspolib::FileOptions
source · pub struct FileOptions {
pub path_or_content: String,
pub wrapwidth: usize,
pub byte_content: Option<Vec<u8>>,
}Expand description
File options struct passed when creating a new PO or MO file
Examples
use std::fs;
use rspolib::FileOptions;
// From path
let opts = FileOptions::from("tests-data/all.po");
assert_eq!(opts.path_or_content, "tests-data/all.po");
assert_eq!(opts.wrapwidth, 78);
// From path and wrap width
let opts = FileOptions::from(("tests-data/obsoletes.po", 80));
assert_eq!(opts.path_or_content, "tests-data/obsoletes.po");
assert_eq!(opts.wrapwidth, 80);
// From bytes
let bytes = fs::read("tests-data/obsoletes.po").unwrap();
let opts = FileOptions::from(bytes);Fields§
§path_or_content: StringPath or content to the file
wrapwidth: usizeWrap width for the PO file, used when converted as a string
byte_content: Option<Vec<u8>>Content as bytes, used by MO files when the content is passed as bytes
Trait Implementations§
source§impl Clone for FileOptions
impl Clone for FileOptions
source§fn clone(&self) -> FileOptions
fn clone(&self) -> FileOptions
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for FileOptions
impl Debug for FileOptions
source§impl Default for FileOptions
impl Default for FileOptions
source§fn default() -> FileOptions
fn default() -> FileOptions
Returns the “default value” for a type. Read more
source§impl<'a> From<&'a str> for FileOptions
impl<'a> From<&'a str> for FileOptions
source§impl From<&FileOptions> for FileOptions
impl From<&FileOptions> for FileOptions
source§impl PartialEq<FileOptions> for FileOptions
impl PartialEq<FileOptions> for FileOptions
source§fn eq(&self, other: &FileOptions) -> bool
fn eq(&self, other: &FileOptions) -> bool
This method tests for
self and other values to be equal, and is used
by ==.