Closed MarkSwanson closed 7 years ago
If I had to guess, it's probably because the saw
field is SAW<'memory, T>
while message_builder
expects a SAW<'saw, T>
. If SAW
is invariant, which is probably is if it contains a mutable reference inside, then its lifetime parameter can't be coerced like this. Try using 'memory
instead of 'saw
for the message_builder
field.
Actually, since it appears Builder
consumes SAW
, you probably don't need to have them as two separate fields in the first place. You could also try removing the saw
field altogether and just constructing the SAW
and the Builder
in the first closure.
Great guess - using 'memory works fine. I may also remove saw. Thank you very much.
In hindsight this seems obvious :-), and is exactly what I want/need.
Hello,
Please help. I'm totally stuck...
The problem is in |saw| - it fails to compile with: cannot infer an appropriate lifetime due to conflicting requirements
Some debugging info: messagebuilder == message::Builder<SAW<', VecMemory>> (I note the lifetime '_)
saw type: cannot use
+=
on type&'saw mut SAW<'memory, VecMemory>
So, it seems positive that SAW<'memory ...> lifetime is mentioned.
The compiler message isn't helping - because it doesn't tell me what the 'conflicting requirements' are :-(
Any ideas?
Thanks!