# InMemoryTranslationProvider

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-protranslate-core/struct-inmemorytranslationprovider/

**struct** · [`ferroui-protranslate-core`](/docs/0.5.0/api/ferroui-protranslate-core/) · v0.5.0

```rust
struct InMemoryTranslationProvider
```



[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/provider.rs#L116)

## Members

- [`new`](#function-new)
- [`try_new`](#function-try_new)
- [`insert`](#function-insert)
- [`try_insert`](#function-try_insert)
- [`insert_many`](#function-insert_many)
- [`remove`](#function-remove)
- [`len`](#function-len)
- [`is_empty`](#function-is_empty)
- [`clear`](#function-clear)

<a id="function-new"></a>

### new

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/provider.rs#L151)

<a id="function-try_new"></a>

### try_new

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/provider.rs#L154)

<a id="function-insert"></a>

### insert

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/provider.rs#L166)

<a id="function-try_insert"></a>

### try_insert

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/provider.rs#L175)

<a id="function-insert_many"></a>

### insert_many

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/provider.rs#L192)

<a id="function-remove"></a>

### remove

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/provider.rs#L215)

<a id="function-len"></a>

### len

```rust
fn len(self: &Self) -> usize
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/provider.rs#L225)

<a id="function-is_empty"></a>

### is_empty

```rust
fn is_empty(self: &Self) -> bool
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/provider.rs#L228)

<a id="function-clear"></a>

### clear

```rust
fn clear(self: &Self)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/provider.rs#L231)

## 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`](/docs/0.5.0/api/ferroui-protranslate-core/trait-translationprovider/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
