Encodes and attempts to write the most efficient map 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)
| 723 | /// This function will return `ValueWriteError` on any I/O error occurred while writing either the |
| 724 | /// marker or the data, except the EINTR, which is handled internally. |
| 725 | pub fn write_map_len<W>(wr: &mut W, len: u32) -> Result<Marker, ValueWriteError> |
| 726 | where W: Write |
| 727 | { |
| 728 | if len < 16 { |
| 729 | let marker = Marker::FixMap(len as u8); |
| 730 | try!(write_fixval(wr, marker)); |
| 731 | Ok(marker) |
| 732 | } else if len < 65536 { |
| 733 | try!(write_marker(wr, Marker::Map16)); |
| 734 | write_data_u16(wr, len as u16).and(Ok(Marker::Map16)) |
| 735 | } else { |
| 736 | try!(write_marker(wr, Marker::Map32)); |
| 737 | write_data_u32(wr, len).and(Ok(Marker::Map32)) |
| 738 | } |
| 739 | } |
| 740 | |
| 741 | /// Encodes and attempts to write the most efficient ext metadata implementation to the given |
| 742 | /// write, returning the marker used. |
no test coverage detected