Skip to main content

Texts

Struct Texts 

Source
pub struct Texts { /* private fields */ }
Expand description

The texts of a catalog in one language.

Implementations§

Source§

impl Texts

Source

pub fn new(language: Language) -> Self

The texts that come with the framework, in this language.

Source

pub fn of(catalog: Catalog, language: impl Into<String>) -> Self

Those of this catalog, in the language of this code, which may be one the framework does not come with.

Source

pub fn language(&self) -> &str

The code of its language.

Source

pub fn catalog(&self) -> &Catalog

The catalog it reads from.

Source

pub fn get(&self, key: &str) -> String

The text of a key, falling back to English, and to the key itself when nobody has it.

Source

pub fn char(&self, key: &str, otherwise: char) -> char

The first character of the text of a key, or this when there is none.

Source

pub fn list(&self, key: &str) -> Vec<String>

The texts under key.0, key.1… as many as there are.

Source

pub fn array<const N: usize>(&self, key: &str) -> [String; N]

The texts under key.0 to key.{N-1}.

Source

pub fn pair(&self, key: &str) -> (String, String)

The texts under key.0 and key.1.

Source

pub fn pair_list(&self, key: &str) -> Vec<(String, String)>

The pairs under key.0, key.1… as many as there are, each with its .0 and .1.

Source

pub fn pairs<const N: usize>(&self, key: &str) -> [(String, String); N]

The pairs under key.0 to key.{N-1}.

Source

pub fn format(&self, key: &str, values: &[&str]) -> String

The text of a key with {0}, {1}… replaced by these.

Trait Implementations§

Source§

impl Clone for Texts

Source§

fn clone(&self) -> Texts

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 Texts

Source§

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

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

impl Default for Texts

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for Texts

Source§

impl PartialEq for Texts

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Texts

Auto Trait Implementations§

§

impl Freeze for Texts

§

impl RefUnwindSafe for Texts

§

impl Send for Texts

§

impl Sync for Texts

§

impl Unpin for Texts

§

impl UnsafeUnpin for Texts

§

impl UnwindSafe for Texts

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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.