1

I am creating a zero-copy account and I am getting this error. This is a type error it seems and I feel I am missing something please help. enter image description here

1
  • 1
    please replace the screenshot with text in a code block to improve this question's seo
    – trent.sol
    Aug 2, 2022 at 4:17

3 Answers 3

1

The struct OTC cannot implement the Copy trait, because Vec is not Copy. Hence it is giving an error the trait Copy may not be implemented for this type;. Here's a good explanation of why some T can't derive the Copy trait. https://doc.rust-lang.org/std/marker/trait.Copy.html#when-cant-my-type-be-copy

0

how can you fix this problem ?

0

Vec can't use zero-copy, you have to use a fixed-length array.

It's also easier to use #[repr(C)] with zero-copy, easier to align items.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.