Struct embedded_lang::Language
source · pub struct Language { /* private fields */ }
Expand description
Represents a single language lookup instance
Implementations§
source§impl Language
impl Language
sourcepub fn new(
name: String,
short_name: String,
strings: HashMap<String, LanguageStringObject>,
resources: HashMap<String, Vec<u8>>
) -> Self
pub fn new( name: String, short_name: String, strings: HashMap<String, LanguageStringObject>, resources: HashMap<String, Vec<u8>> ) -> Self
Create a new language instance
Arguments
name
- Full language nameshort_name
- Language codestrings
- Language lookup table
sourcepub fn new_from_string(
json: &str,
resources: HashMap<String, Vec<u8>>
) -> Result<Self, String>
pub fn new_from_string( json: &str, resources: HashMap<String, Vec<u8>> ) -> Result<Self, String>
sourcepub fn new_from_file(
path: &str,
resources: HashMap<String, Vec<u8>>
) -> Result<Self, String>
pub fn new_from_file( path: &str, resources: HashMap<String, Vec<u8>> ) -> Result<Self, String>
sourcepub fn short_name(&self) -> &str
pub fn short_name(&self) -> &str
Get language code
sourcepub fn utf8_resource(&self, name: &str) -> Option<&str>
pub fn utf8_resource(&self, name: &str) -> Option<&str>
Return an embedded resource as a utf8 string
sourcepub fn binary_resource(&self, name: &str) -> Option<&[u8]>
pub fn binary_resource(&self, name: &str) -> Option<&[u8]>
Return an embedded resource as a slice of bytes
Trait Implementations§
source§impl<'de> Deserialize<'de> for Language
impl<'de> Deserialize<'de> for Language
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
source§impl PartialEq for Language
impl PartialEq for Language
impl Eq for Language
impl StructuralEq for Language
impl StructuralPartialEq for Language
Auto Trait Implementations§
impl RefUnwindSafe for Language
impl Send for Language
impl Sync for Language
impl Unpin for Language
impl UnwindSafe for Language
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