fluent_static_function/
lib.rs

1use std::any::type_name;
2
3use fluent_static_value::Value;
4
5pub mod builtins;
6
7pub type FluentFunction<'a, 'b> = fn(&'a [Value<'a>], &'a [(&'a str, Value<'a>)]) -> Value<'b>;
8
9pub trait FluentFunctionDescriptor {
10    fn type_name(&self) -> &'static str;
11}
12
13impl<'b, F> FluentFunctionDescriptor for F
14where
15    F: for<'a> Fn(&'a [Value<'a>], &'a [(&'a str, Value<'a>)]) -> Value<'b> + 'static,
16{
17    fn type_name(&self) -> &'static str {
18        type_name::<Self>()
19    }
20}