When I send the Datum (trait) over the channel, it works, but if I send the reference over the channel of the field stored in Datum, i.e., &self.value, it does not work.
How can I solve the error in the function send_over_channel_vec?
Is this because I am passing the ownership when passing the trait? But at some point, I will have to extract the value and pass; in that case, what is the right way to do it?
Yes, once you've consumed MyData because you've extracted the underlying vector, you won't be able to use it again. Another option, if you need to keep your instance of MyData around, would be to clone the data from MyData and send the clone.
Thank you. I was trying to avoid clone() because that data could be a lot. Datum is coming from tonic, and I have written a trait to abstract the internals.
Is there anything I can do differently (some refactoring) to pass the reference without cloning the Vec<u8>?