Byte_string and serde

I can't get this code to compile:


#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct Test {
    x: byte_string::ByteString,
}

According to the docs above, a ByteString is just a Vec<u8> with overloaded Debug. Am I doing something wrong with serde, or does ByteString, for some reason, not support serde?

ByteString has to explicitly implement the serde traits itself for your derive to automatically work. You can ask them to do so, or you can bypass this with a remote derive, accessing its public Vec<u8>.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.