| 1 | use crate::types::FluentType; | 
| 2 | use intl_memoizer::Memoizable; | 
|---|
| 3 | use unic_langid::LanguageIdentifier; | 
|---|
| 4 |  | 
|---|
| 5 | /// This trait contains thread-safe methods which extend [intl_memoizer::IntlLangMemoizer]. | 
|---|
| 6 | /// It is used as the generic bound in this crate when a memoizer is needed. | 
|---|
| 7 | pub trait MemoizerKind: 'static { | 
|---|
| 8 | fn new(lang: LanguageIdentifier) -> Self | 
|---|
| 9 | where | 
|---|
| 10 | Self: Sized; | 
|---|
| 11 |  | 
|---|
| 12 | /// A threadsafe variant of `with_try_get` from [intl_memoizer::IntlLangMemoizer]. | 
|---|
| 13 | /// The generics enforce that `Self` and its arguments are actually threadsafe. | 
|---|
| 14 | /// | 
|---|
| 15 | /// `I` - The [Memoizable](intl_memoizer::Memoizable) internationalization formatter. | 
|---|
| 16 | /// | 
|---|
| 17 | /// `R` - The result from the format operation. | 
|---|
| 18 | /// | 
|---|
| 19 | /// `U` - The callback that accepts the instance of the intl formatter, and generates | 
|---|
| 20 | ///       some kind of results `R`. | 
|---|
| 21 | fn with_try_get_threadsafe<I, R, U>(&self, args: I::Args, callback: U) -> Result<R, I::Error> | 
|---|
| 22 | where | 
|---|
| 23 | Self: Sized, | 
|---|
| 24 | I: Memoizable + Send + Sync + 'static, | 
|---|
| 25 | I::Args: Send + Sync + 'static, | 
|---|
| 26 | U: FnOnce(&I) -> R; | 
|---|
| 27 |  | 
|---|
| 28 | /// Wires up the `as_string` or `as_string_threadsafe` variants for [`FluentType`]. | 
|---|
| 29 | fn stringify_value(&self, value: &dyn FluentType) -> std::borrow::Cow<'static, str>; | 
|---|
| 30 | } | 
|---|
| 31 |  | 
|---|