summaryrefslogtreecommitdiffstats
path: root/third_party/rust/fluent-bundle/src/memoizer.rs
blob: c738a857b2f6a367a954bf01a6cf2f17d747fbf4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::types::FluentType;
use intl_memoizer::Memoizable;
use unic_langid::LanguageIdentifier;

pub trait MemoizerKind: 'static {
    fn new(lang: LanguageIdentifier) -> Self
    where
        Self: Sized;

    fn with_try_get_threadsafe<I, R, U>(&self, args: I::Args, cb: U) -> Result<R, I::Error>
    where
        Self: Sized,
        I: Memoizable + Send + Sync + 'static,
        I::Args: Send + Sync + 'static,
        U: FnOnce(&I) -> R;

    fn stringify_value(&self, value: &dyn FluentType) -> std::borrow::Cow<'static, str>;
}