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)
| 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. |
| 702 | pub 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. |
no test coverage detected