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

Function assert_encode_error

libs/@local/harpc/wire-protocol/src/codec/encode.rs:169–184  ·  view source on GitHub ↗
(value: &T, expected: &T::Error)

Source from the content-addressed store, hash-verified

167
168 #[track_caller]
169 pub(crate) fn assert_encode_error<T>(value: &T, expected: &T::Error)
170 where
171 T: Encode,
172 T::Error: PartialEq,
173 {
174 let mut bytes = BytesMut::new();
175 let mut buffer = Buffer::new(&mut bytes);
176
177 let result = value
178 .encode(&mut buffer)
179 .expect_err("should fail to encode");
180
181 let context = result.current_context();
182
183 assert_eq!(*context, *expected);
184 }
185
186 #[test]
187 fn encode_u16() {

Callers 2

encode_bytes_too_largeFunction · 0.85

Calls 2

current_contextMethod · 0.80
encodeMethod · 0.45

Tested by 2

encode_bytes_too_largeFunction · 0.68