Skip to main content

ServerCopy

Trait ServerCopy 

Source
pub trait ServerCopy {
    // Required methods
    fn name(&self) -> &'static str;
    fn entries(&self) -> Vec<(&'static str, &LocalizedText)>;
    fn entries_mut(&mut self) -> Vec<(&'static str, &mut LocalizedText)>;

    // Provided method
    fn translated(
        self,
        locale: impl Into<Locale>,
        texts: &[(&str, &str)],
    ) -> Self
       where Self: Sized { ... }
}
Expand description

Copy a user reads, sentence by sentence, by the name of its field.

Required Methods§

Source

fn name(&self) -> &'static str

The copy’s name, for a report.

Source

fn entries(&self) -> Vec<(&'static str, &LocalizedText)>

Every sentence, by the name of its field.

Source

fn entries_mut(&mut self) -> Vec<(&'static str, &mut LocalizedText)>

Every sentence, to change in place.

Provided Methods§

Source

fn translated(self, locale: impl Into<Locale>, texts: &[(&str, &str)]) -> Self
where Self: Sized,

Lays texts, by field name, over this copy as its text in locale: a new language, or the built-in one replaced. A field left out keeps what it had.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§