MCPcopy Create free account
hub / github.com/hashintel/hash / encode

Method encode

libs/@local/codec/src/harpc/wire.rs:80–85  ·  view source on GitHub ↗

Encodes a protocol message into the destination buffer. # Performance Time complexity is O(n) where n is the size of the message being encoded. Space complexity depends on the implementation of `T::encode()`. # Errors Returns an error if the encoding operation fails.

(&mut self, item: T, dst: &mut BytesMut)

Source from the content-addressed store, hash-verified

78 ///
79 /// Returns an error if the encoding operation fails.
80 fn encode(&mut self, item: T, dst: &mut BytesMut) -> Result<(), Self::Error> {
81 let mut buffer = Buffer::new(dst);
82
83 item.encode(&mut buffer)
84 .change_context(io::Error::from(io::ErrorKind::InvalidData))
85 }
86}
87
88impl<T> Decoder for ProtocolCodec<T>

Callers 7

encode_decode_requestFunction · 0.45
encode_decode_responseFunction · 0.45
partial_decodeFunction · 0.45
zero_length_payloadFunction · 0.45
large_payloadFunction · 0.45
invalid_length_markerFunction · 0.45
mod.rsFile · 0.45

Calls 2

fromFunction · 0.50
change_contextMethod · 0.45

Tested by 5

encode_decode_requestFunction · 0.36
encode_decode_responseFunction · 0.36
partial_decodeFunction · 0.36
zero_length_payloadFunction · 0.36
large_payloadFunction · 0.36