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

Function write_bin

src/encode.rs:688–693  ·  view source on GitHub ↗

Encodes and attempts to write the most efficient binary implementation to the given `Write`. # Errors This function will return `ValueWriteError` on any I/O error occurred while writing either the marker or the data, except the EINTR, which is handled internally. TODO: Docs, range check, example, visibility.

(wr: &mut W, data: &[u8])

Source from the content-addressed store, hash-verified

686/// marker or the data, except the EINTR, which is handled internally.
687// TODO: Docs, range check, example, visibility.
688pub fn write_bin<W>(wr: &mut W, data: &[u8]) -> Result<(), ValueWriteError>
689 where W: Write
690{
691 try!(write_bin_len(wr, data.len() as u32));
692 wr.write_all(data).map_err(|err| ValueWriteError::InvalidDataWrite(WriteError(err)))
693}
694
695/// Encodes and attempts to write the most efficient array length implementation to the given write,
696/// returning the marker used.

Callers 2

write_valueFunction · 0.85
write_value_refFunction · 0.85

Calls 2

write_bin_lenFunction · 0.85
WriteErrorClass · 0.85

Tested by

no test coverage detected