Skip to content

Using Yoke with a custom cart datatype wrapping a Vec #4908

Answered by sffc
G33KatWork asked this question in Q&A
Discussion options

You must be logged in to vote

The signature of fn parse is super important. Is it this one you posted?

fn parse<'a, P: ParsablePacket<&'a [u8], ()>>(&'a mut self) -> Result<P, P::Error>

That would not work because you are borrowing x as an &mut, so any additional borrows borrow from the short-lived mutable reference. You can't mutate x inside of attach_to_cart.

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@G33KatWork
Comment options

@sffc
Comment options

Answer selected by G33KatWork
@G33KatWork
Comment options

@sffc
Comment options

@G33KatWork
Comment options

@sffc
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants