pub struct LocalizedText {
pub key: String,
pub translations: BTreeMap<String, String>,
pub params: Vec<String>,
}Expand description
A user-visible text declared together with all of its translations.
key is assigned by the compiler and traces back to the declaration.
params lists interpolation names such as count in {count}.
Fields§
§key: String§translations: BTreeMap<String, String>§params: Vec<String>Implementations§
Source§impl LocalizedText
impl LocalizedText
pub fn new<'a>(pairs: impl IntoIterator<Item = (&'a str, &'a str)>) -> Self
pub fn get(&self, language: &str) -> Option<&str>
Sourcepub fn placeholders(text: &str) -> Result<Vec<String>, String>
pub fn placeholders(text: &str) -> Result<Vec<String>, String>
Interpolation names referenced by one translation, in order of first
use. The text is checked as a whole: see crate::format.
Trait Implementations§
Source§impl Clone for LocalizedText
impl Clone for LocalizedText
Source§impl Debug for LocalizedText
impl Debug for LocalizedText
Source§impl Default for LocalizedText
impl Default for LocalizedText
Source§impl<'de> Deserialize<'de> for LocalizedText
impl<'de> Deserialize<'de> for LocalizedText
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 LocalizedText
Source§impl Hash for LocalizedText
impl Hash for LocalizedText
Source§impl PartialEq for LocalizedText
impl PartialEq for LocalizedText
Source§impl Serialize for LocalizedText
impl Serialize for LocalizedText
impl StructuralPartialEq for LocalizedText
Auto Trait Implementations§
impl Freeze for LocalizedText
impl RefUnwindSafe for LocalizedText
impl Send for LocalizedText
impl Sync for LocalizedText
impl Unpin for LocalizedText
impl UnsafeUnpin for LocalizedText
impl UnwindSafe for LocalizedText
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