summaryrefslogtreecommitdiffstats
path: root/third_party/rust/fluent-bundle/src/resolver/mod.rs
blob: f137bcc91b8997d820f905f15ed0ae8f1d275cc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
pub mod errors;
mod expression;
mod inline_expression;
mod pattern;
mod scope;

pub use errors::ResolverError;
pub use scope::Scope;

use std::borrow::Borrow;
use std::fmt;

use crate::memoizer::MemoizerKind;
use crate::resource::FluentResource;
use crate::types::FluentValue;

// Converts an AST node to a `FluentValue`.
pub(crate) trait ResolveValue {
    fn resolve<'source, 'errors, R, M>(
        &'source self,
        scope: &mut Scope<'source, 'errors, R, M>,
    ) -> FluentValue<'source>
    where
        R: Borrow<FluentResource>,
        M: MemoizerKind;
}

pub(crate) trait WriteValue {
    fn write<'source, 'errors, W, R, M>(
        &'source self,
        w: &mut W,
        scope: &mut Scope<'source, 'errors, R, M>,
    ) -> fmt::Result
    where
        W: fmt::Write,
        R: Borrow<FluentResource>,
        M: MemoizerKind;

    fn write_error<W>(&self, _w: &mut W) -> fmt::Result
    where
        W: fmt::Write;
}