XAMPPRocky / fluent-templates

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

Add function that returns available locales #17

Closed technic closed 4 years ago

technic commented 4 years ago

This extends the Loader trait Fixes https://github.com/XAMPPRocky/fluent-templates/issues/15

I think returning iterator is more lightweight solution than the vector. The only drawback is that I return Boxed object due to the polymorphic nature of the iterator. It is also should be possible to avoid boxing by adding the associated type to the trait. However, I couldn't get the lifetimes right in my first try, so are you happy with Box?

technic commented 4 years ago

Actually maybe I no longer need this after https://github.com/XAMPPRocky/fluent-templates/pull/16

XAMPPRocky commented 4 years ago

Thank you for your PR! I think boxing is fine for now. I think the method would still be useful to have; for example if you wanted to print a list of locales.

technic commented 4 years ago

The failing build is not related to my change. Seems like it is due to changes in flume, why is it building with v 0.7.2?

XAMPPRocky commented 4 years ago

Because in cargo flume = "0.7.1" is equivalent to ^0.7.1 where it will use semver compatible versions. You can address that by setting it to "=0.7.1".

technic commented 4 years ago

Thanks for explanation on cargo version policy. It should be another PR then.

technic commented 4 years ago

@XAMPPRocky I am about to push a PR to fix it.

technic commented 4 years ago

Rebased onto master.

XAMPPRocky commented 4 years ago

Thank you for your PR!