Function rmpv::encode::write_value_ref [−][src]
pub fn write_value_ref<W>(wr: &mut W, val: &ValueRef<'_>) -> Result<(), Error> where
W: Write,
Encodes and attempts to write the given non-owning ValueRef into the Write.
Errors
This function returns Error with an underlying I/O error if unable to properly write entire value. Interruption errors are handled internally by silent operation restarting.
Examples
use rmpv::ValueRef; use rmpv::encode::write_value_ref; let mut buf = Vec::new(); let val = ValueRef::from("le message"); write_value_ref(&mut buf, &val).unwrap(); assert_eq!(vec![0xaa, 0x6c, 0x65, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65], buf);