Skip to main content

PluralSlot

Struct PluralSlot 

Source
#[non_exhaustive]
pub struct PluralSlot { pub group: Box<str>, pub kind: PluralKind, pub category: Option<Box<str>>, pub index: Option<u8>, pub arg: Option<Box<str>>, pub parent: Option<Box<str>>, pub added: bool, }
Expand description

One form of a plural group. Build it with PluralSlot::new and the with_* methods. Optional fields are left out of the JSON when unset, added when false.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§group: Box<str>

Shared by every form of one message (one plural or select argument), unique in the document.

§kind: PluralKind

Cardinal, ordinal or select.

§category: Option<Box<str>>

The CLDR category (one, few), an exact value (=0) or a select key (female). gettext has none: its order is not CLDR order (see index).

§index: Option<u8>

The gettext msgstr[N] index.

§arg: Option<Box<str>>

The ICU argument name (count), when known.

§parent: Option<Box<str>>

The enclosing group, for a plural inside a select (or any nesting).

§added: bool

A target category the source does not have, added at extract so it can be translated (and a unit inside such a form). Untranslated, it writes what the source other form gives.

Implementations§

Source§

impl PluralSlot

Source

pub fn new(group: impl Into<Box<str>>, kind: PluralKind) -> PluralSlot

A form of group of this kind, with no category, index, argument or parent.

Source

pub fn with_category(self, category: impl Into<Box<str>>) -> PluralSlot

Sets the category.

Source

pub fn with_index(self, index: u8) -> PluralSlot

Sets the gettext index.

Source

pub fn with_arg(self, arg: impl Into<Box<str>>) -> PluralSlot

Sets the argument name.

Source

pub fn with_parent(self, parent: impl Into<Box<str>>) -> PluralSlot

Sets the enclosing group.

Source

pub fn with_added(self, added: bool) -> PluralSlot

Marks the form as added for the target language (or not).

Source

pub fn group(&self) -> &str

The group.

Source

pub fn kind(&self) -> PluralKind

The kind.

Source

pub fn category(&self) -> Option<&str>

The category.

Source

pub fn index(&self) -> Option<u8>

The gettext index.

Source

pub fn arg(&self) -> Option<&str>

The argument name.

Source

pub fn parent(&self) -> Option<&str>

The enclosing group.

Source

pub fn is_added(&self) -> bool

True for a form the target needs and the source does not have.

Trait Implementations§

Source§

impl Clone for PluralSlot

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PluralSlot

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for PluralSlot

Source§

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 Eq for PluralSlot

Source§

impl PartialEq for PluralSlot

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for PluralSlot

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for PluralSlot

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.