How to make this compile?

#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct TVec<T: Clone> {
    pub data: Rc<[T]>,}


error[E0277]: the trait bound `std::rc::Rc<[T]>: Serialize` is not satisfied

7 |     pub data: Rc<[T]>,}
  |     ^^^ the trait `Serialize` is not implemented for `std::rc::Rc<[T]>`

How do I fix this ?

Works for me in the playground?

Edit: Ah! Looks like you’ve got to enable the relevant feature.

1 Like

Did not realize 'serde' had an 'rc' feature. Thanks!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.