Function serde_rosmsg::to_writer
[−]
[src]
pub fn to_writer<W, T>(writer: &mut W, value: &T) -> Result<()> where
W: Write,
T: Serialize,
Serialize the given data structure T
as ROSMSG into the IO stream.
Serialization can fail if T
's implementation of Serialize
decides to
fail. It can also fail if the structure contains unsupported elements.
Finally, it can also fail due to writer failure.
Examples
let mut cursor = std::io::Cursor::new(Vec::new()); to_writer(&mut cursor, &String::from("Hello, World!")).unwrap(); assert_eq!(cursor.into_inner(), b"\x11\0\0\0\x0d\0\0\0Hello, World!");