MCPcopy Create free account
hub / github.com/3Hren/msgpack-rust / write_u8

Function write_u8

src/encode.rs:296–301  ·  view source on GitHub ↗

Encodes and attempts to write an `u8` value as a 2-byte sequence into the given write. The first byte becomes the marker and the second one will represent the data itself. Note, that this function will encode the given value in 2-byte sequence no matter what, even if the value can be represented using single byte as a positive fixnum. If you need to fit the given buffer efficiently use `write_u

(wr: &mut W, val: u8)

Source from the content-addressed store, hash-verified

294/// assert_eq!([0xcc, 0x2a], buf);
295/// ```
296pub fn write_u8<W>(wr: &mut W, val: u8) -> Result<(), ValueWriteError>
297 where W: Write
298{
299 try!(write_marker(wr, Marker::U8));
300 write_data_u8(wr, val)
301}
302
303/// Encodes and attempts to write an `u16` value strictly as a 3-byte sequence into the given write.
304///

Callers 3

write_uintFunction · 0.85
write_sint_effFunction · 0.85
pass_pack_u8Function · 0.85

Calls 1

write_markerFunction · 0.85

Tested by 1

pass_pack_u8Function · 0.68