InMemoryTranslationProvider
struct · ferroui-protranslate-core · v0.5.0
struct InMemoryTranslationProvider
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.
try_new
fn try_new(name: impl Into<String>) -> Result<Self, TranslationError>
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.
try_insert
fn try_insert(self: &Self, culture: Culture, key: impl Into<String>, value: impl Into<String>) -> Result<Option<String>, TranslationError>
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.
remove
fn remove(self: &Self, culture: &Culture, key: &str) -> Option<String>
len
fn len(self: &Self) -> usize
is_empty
fn is_empty(self: &Self) -> bool
clear
fn clear(self: &Self)
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyErasedDestructorIntoEitherDefaultTranslationProvider
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.