Function serde_rosmsg::to_vec
[−]
[src]
pub fn to_vec<T>(value: &T) -> Result<Vec<u8>> where T: Serialize
Serialize the given data structure T
as a ROSMSG byte vector.
Serialization can fail if T
's implementation of Serialize
decides to
fail. It can also fail if the structure contains unsupported elements.
Examples
let data = to_vec(&String::from("Hello, World!")).unwrap(); assert_eq!(data, b"\x11\0\0\0\x0d\0\0\0Hello, World!");