pub enum MsgStr {
None,
Singular(String),
Plural(Vec<String>),
}Expand description
Message translation payload for a PO item.
Variants§
None
No translation values are present.
Singular(String)
Single translation string.
Plural(Vec<String>)
Plural translation strings indexed by plural slot.
Implementations§
Source§impl MsgStr
impl MsgStr
Sourcepub fn plural(values: Vec<String>) -> MsgStr
pub fn plural(values: Vec<String>) -> MsgStr
Creates a plural translation payload without normalizing by slot count.
Use this when the plural shape matters even if the value vector has one
slot, such as gettext catalogs for one-form locales. From<Vec<String>>
normalizes empty vectors to MsgStr::None and single-value vectors to
MsgStr::Singular.
Sourcepub fn get(&self, index: usize) -> Option<&str>
pub fn get(&self, index: usize) -> Option<&str>
Returns the translation at index without panicking.
Sourcepub fn iter(&self) -> MsgStrIter<'_> ⓘ
pub fn iter(&self) -> MsgStrIter<'_> ⓘ
Iterates over all translation values in order.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for MsgStr
impl<'de> Deserialize<'de> for MsgStr
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<MsgStr, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<MsgStr, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for MsgStr
Source§impl<'a> IntoIterator for &'a MsgStr
impl<'a> IntoIterator for &'a MsgStr
Source§impl Serialize for MsgStr
impl Serialize for MsgStr
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for MsgStr
Auto Trait Implementations§
impl Freeze for MsgStr
impl RefUnwindSafe for MsgStr
impl Send for MsgStr
impl Sync for MsgStr
impl Unpin for MsgStr
impl UnsafeUnpin for MsgStr
impl UnwindSafe for MsgStr
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