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

sffc May 15, 2024
Maintainer

Answer selected by G33KatWork
@G33KatWork
Comment options

@sffc
Comment options

sffc May 15, 2024
Maintainer

@G33KatWork
Comment options

@sffc
Comment options

sffc May 17, 2024
Maintainer

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