You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FluentArgs's key API (beyond construction) would appear to be get. Maybe also iter; I don't know if that's actually needed.
Can we replace the type with a trait?
pubtraitArguments{fnget(&self,key:&str) -> Option<FluentValue<'_>>;// if necessary:// type Iter<'a>: Iterator<Item = (&'a str, FluentValue<'a>)> + 'a;// fn iter(&self) -> Self::Iter<'_>;// (Later this can just use impl Trait: see RFC#3425.)}
(Technically, FluentArgs and fluent_args! don't need to change, but FluentBundle::write_pattern, format_pattern should use the trait.)
Motivation: this allows any type implementing fluent::Arguments to be used as arguments (often just via a derive macro). So, say, a Druid widget FluentText: druid::Widget<T> with data: &T could directly use that data type as arguments.
Edit: return FluentValue by value not ref to allow construction in get and Iterator::next.
The text was updated successfully, but these errors were encountered:
Catch: in some cases the data might be a simple type, e.g. i32.
Solution: provide implementations of Arguments for such types using a fixed key ("value"?).
FluentArgs
's key API (beyond construction) would appear to beget
. Maybe alsoiter
; I don't know if that's actually needed.Can we replace the type with a trait?
(Technically,
FluentArgs
andfluent_args!
don't need to change, butFluentBundle::write_pattern
,format_pattern
should use the trait.)Motivation: this allows any type implementing
fluent::Arguments
to be used as arguments (often just via a derive macro). So, say, a Druid widgetFluentText: druid::Widget<T>
withdata: &T
could directly use that data type as arguments.Edit: return
FluentValue
by value not ref to allow construction inget
andIterator::next
.The text was updated successfully, but these errors were encountered: