Closed duskmoon314 closed 1 year ago
It seems the problem happens in the struct S
, which uses map
during deku's parsing. I will keep digging out what happens
It turns out a field inside S
, which has the type of another crate, keeps the reference and causes this issue. Sorry for bothering.
There is also TryFrom which gets implemented as part of the DekuRead derive, S::try_from(&s1)
I'm trying to wrap
from_bytes
in aTryFrom
implementation and coming across the issue ofcannot return value referencing local variable
. It seemsfrom_bytes
borrow the variable instead of consuming it.More specifically, I have a base64 encoded string in struct
O
and a structS
(which might be too complicated to describe here), which needs to be parsed from the encoded string. My idea is to implement aTryFrom<O>
forS
like this:But this borrows the origin and cannot return. Thus I try this:
I want to have a way to consume the original slice of bytes and return the result after parsing. How can I achieve this?