pub trait EsFluentChoice {
// Required method
fn as_fluent_choice(&self) -> &'static str;
}Expand description
This trait is used to convert an enum into a string that can be used as a Fluent choice.
§Example
use es_fluent::EsFluentChoice;
enum MyEnum {
Variant1,
Variant2,
}
impl EsFluentChoice for MyEnum {
fn as_fluent_choice(&self) -> &'static str {
match self {
MyEnum::Variant1 => "variant1",
MyEnum::Variant2 => "variant2",
}
}
}
let my_enum = MyEnum::Variant1;
assert_eq!(my_enum.as_fluent_choice(), "variant1");