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

Function write_array_len

src/encode.rs:702–716  ·  view source on GitHub ↗

Encodes and attempts to write the most efficient array length implementation to the given write, returning the marker used. # 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.

(wr: &mut W, len: u32)

Source from the content-addressed store, hash-verified

700/// This function will return `ValueWriteError` on any I/O error occurred while writing either the
701/// marker or the data, except the EINTR, which is handled internally.
702pub fn write_array_len<W>(wr: &mut W, len: u32) -> Result<Marker, ValueWriteError>
703 where W: Write
704{
705 if len < 16 {
706 let marker = Marker::FixArray(len as u8);
707 try!(write_fixval(wr, marker));
708 Ok(marker)
709 } else if len < 65536 {
710 try!(write_marker(wr, Marker::Array16));
711 write_data_u16(wr, len as u16).and(Ok(Marker::Array16))
712 } else {
713 try!(write_marker(wr, Marker::Array32));
714 write_data_u32(wr, len).and(Ok(Marker::Array32))
715 }
716}
717
718/// Encodes and attempts to write the most efficient map length implementation to the given write,
719/// returning the marker used.

Callers 10

write_valueFunction · 0.85
emit_enumMethod · 0.85
emit_enum_variantMethod · 0.85
emit_tupleMethod · 0.85
emit_seqMethod · 0.85
visit_unit_variantMethod · 0.85
visit_tuple_variantMethod · 0.85
visit_seqMethod · 0.85
visit_structMethod · 0.85
write_value_refFunction · 0.85

Calls 2

write_fixvalFunction · 0.85
write_markerFunction · 0.85

Tested by

no test coverage detected