XAMPPRocky / fluent-templates

Easily add Fluent to your Rust project.
Apache License 2.0
136 stars 28 forks source link

Allow arguments to be &'static str #23

Closed kgv closed 3 years ago

kgv commented 3 years ago

I suggest сhange signature lookup_complete(... args: Option<&HashMap<String, FluentValue>>) -> String to something like lookup_complete<T: AsRef<str> + 'static>(... args: Option<&HashMap<T, FluentValue>>) -> String. This will remove unnecessary allocations from user code.

playground

XAMPPRocky commented 3 years ago

Thank you for your issue! That seems like good idea to me, as long you can continue to provide HashMap<String, V>. If you’d like to contribute I’d accept a PR implementing this, otherwise I might work on it later in the week.