Closed JohnnyJayJay closed 4 years ago
I was just made aware of #123 and its corresponding PR. While that doesn't fix it for me, the discussion there gave me the idea to reduce the lifetime of FluentArgs only to the scope where they are needed. It still requires me to go through a fair amount of boiler plate to obtain a HashMap<&str, FluentValue>
, but it works now.
As mentioned in #170 , I am currently writing Java bindings for this project.
There is another issue I encountered: the use of
&str
as a key type inFluentArgs
makes insertion of strings from other scopes impossible without leaking memory. For example, this is not possible, becauseparam
is dropped:This results in the fact that you can essentially only use literals as arguments for that method, unless you leak memory to make a
&'static str
.My suggestion would be to use a different key type, such as
Cow<str>
orString
. This would certainly be quite a breaking change, so I'm open to ideas how to fix this on the spot.This issue may not only be relevant for my specific use case, I think.