Encode `s` as the _bytes_ primitive type. This writes the length as the _long_ primitive and then the raw bytes.
(
s: &B,
mut writer: W,
)
| 44 | /// |
| 45 | /// This writes the length as the _long_ primitive and then the raw bytes. |
| 46 | pub(crate) fn encode_bytes<B: AsRef<[u8]> + ?Sized, W: Write>( |
| 47 | s: &B, |
| 48 | mut writer: W, |
| 49 | ) -> AvroResult<usize> { |
| 50 | let bytes = s.as_ref(); |
| 51 | encode_long(bytes.len() as i64, &mut writer)?; |
| 52 | writer |
| 53 | .write(bytes) |
| 54 | .map_err(|e| Details::WriteBytes(e).into()) |
| 55 | } |
| 56 | |
| 57 | pub(crate) fn encode_long<W: Write>(i: i64, writer: W) -> AvroResult<usize> { |
| 58 | zig_i64(i, writer) |
no test coverage detected