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

Function encode_value

libs/@local/harpc/wire-protocol/src/codec/encode.rs:100–112  ·  view source on GitHub ↗
(value: &T)

Source from the content-addressed store, hash-verified

98
99 #[track_caller]
100 pub(crate) fn encode_value<T>(value: &T) -> Bytes
101 where
102 T: Encode,
103 {
104 let mut bytes = BytesMut::new();
105 let mut buffer = Buffer::new(&mut bytes);
106
107 value
108 .encode(&mut buffer)
109 .expect("should be able to encode value");
110
111 bytes.freeze()
112 }
113
114 #[track_caller]
115 #[expect(clippy::needless_pass_by_value)]

Callers 7

header_sizeFunction · 0.85
decode_beginFunction · 0.85
decode_frameFunction · 0.85
assert_encodeFunction · 0.85
encode_bytes_fullFunction · 0.85
assert_codecFunction · 0.85
header_sizeFunction · 0.85

Calls 2

expectMethod · 0.45
encodeMethod · 0.45

Tested by 3

decode_beginFunction · 0.68
decode_frameFunction · 0.68
encode_bytes_fullFunction · 0.68