FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    InMemoryTranslationProvider

    struct · ferroui-protranslate-core · v0.5.0

    struct InMemoryTranslationProvider
    

    View source

    Members

    new

    fn new(name: impl Into<String>) -> Self
    

    Construct a named catalog. Use try_new for names supplied by users.

    Panics

    Panics if the name is empty or whitespace.

    Source

    try_new

    fn try_new(name: impl Into<String>) -> Result<Self, TranslationError>
    

    Source

    insert

    fn insert(self: &Self, culture: Culture, key: impl Into<String>, value: impl Into<String>) -> Option<String>
    

    Insert a translation. Empty values are intentional translations.

    Panics

    Panics if the key is empty or whitespace; try_insert is recoverable.

    Source

    try_insert

    fn try_insert(self: &Self, culture: Culture, key: impl Into<String>, value: impl Into<String>) -> Result<Option<String>, TranslationError>
    

    Source

    insert_many

    fn insert_many<K: Into<String>, V: Into<String>>(self: &Self, culture: Culture, translations: impl IntoIterator<Item = (K, V)>) -> Result<(), TranslationError>
    

    Add a culture's catalog atomically: an invalid key rejects the complete batch without changing translations or the provider revision.

    Source

    remove

    fn remove(self: &Self, culture: &Culture, key: &str) -> Option<String>
    

    Source

    len

    fn len(self: &Self) -> usize
    

    Source

    is_empty

    fn is_empty(self: &Self) -> bool
    

    Source

    clear

    fn clear(self: &Self)
    

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • Borrow<T>
    • BorrowMut<T>
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ErasedDestructor
    • IntoEither
    • Default
    • TranslationProvider

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.