I was experimenting with crate bincode and I encountered this error: “temporary value does not live long enough” when I used config this way:
let ser = config().big_endian(); // This would not compile.
but if I create a local variable like conf (below code), it compiles.
let mut conf = config(); let ser = conf.big_endian();
Any explanation for this behavior?
error[E0597]: borrowed value does not live long enough
- temporary value dropped here while still borrowed
temporary value does not live long enough