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

Function write_str

src/encode.rs:649–654  ·  view source on GitHub ↗

Encodes and attempts to write the most efficient string 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: &str)

Source from the content-addressed store, hash-verified

647/// marker or the data, except the EINTR, which is handled internally.
648// TODO: Docs, range check, example, visibility.
649pub fn write_str<W>(wr: &mut W, data: &str) -> Result<(), ValueWriteError>
650 where W: Write
651{
652 try!(write_str_len(wr, data.len() as u32));
653 wr.write_all(data.as_bytes()).map_err(|err| ValueWriteError::InvalidDataWrite(WriteError(err)))
654}
655
656/// Encodes and attempts to write the most efficient binary array length implementation to the given
657/// write, returning the marker used.

Callers 4

write_valueFunction · 0.85
emit_strMethod · 0.85
visit_strMethod · 0.85
write_value_refFunction · 0.85

Calls 2

write_str_lenFunction · 0.85
WriteErrorClass · 0.85

Tested by

no test coverage detected