MCPcopy Create free account
hub / github.com/apache/avro-rs / encode_bytes

Function encode_bytes

avro/src/encode.rs:46–55  ·  view source on GitHub ↗

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,
)

Source from the content-addressed store, hash-verified

44///
45/// This writes the length as the _long_ primitive and then the raw bytes.
46pub(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
57pub(crate) fn encode_long<W: Write>(i: i64, writer: W) -> AvroResult<usize> {
58 zig_i64(i, writer)

Callers 3

big_decimal_as_bytesFunction · 0.85
serialize_big_decimalFunction · 0.85
encode_internalFunction · 0.85

Calls 4

encode_longFunction · 0.85
as_refMethod · 0.80
lenMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected