pub struct Model { /* private fields */ }
Expand description
The data model for a set of internationalized messages. Every file has a locale ID that it applies to, as well as the number of total messages analyzed when this locale was produced
Use Model::from_json_reader to make a new instance of the Model from its JSON serialization. Use [Model::from_dictionaries] to make a new instance of the Model based on the supplied dictionaries.
In tests, you can use Model::from_parts to create Model quickly without any checks.
Implementations§
Source§impl Model
impl Model
pub fn locale(&self) -> &str
pub fn messages(&self) -> &Messages
Sourcepub fn from_json_reader<R: Read>(r: R) -> Result<Model>
pub fn from_json_reader<R: Read>(r: R) -> Result<Model>
Deserializes the Model from the supplied reader. Use to create a functional Model from JSON.
Sourcepub fn to_json_writer<W: Write>(&self, writer: W) -> Result<()>
pub fn to_json_writer<W: Write>(&self, writer: W) -> Result<()>
Writes the Model into the supplied writer encoded as JSON. Use to persist the Model into JSON. The message ordering is not guaranteed.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Model
impl<'de> Deserialize<'de> for Model
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Model
impl StructuralPartialEq for Model
Auto Trait Implementations§
impl Freeze for Model
impl RefUnwindSafe for Model
impl Send for Model
impl Sync for Model
impl Unpin for Model
impl UnwindSafe for Model
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)