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

Function assert_decode_error

libs/@local/harpc/wire-protocol/src/codec/decode.rs:110–126  ·  view source on GitHub ↗
(
        bytes: impl Into<Bytes>,
        expected: &T::Error,
        context: T::Context,
    )

Source from the content-addressed store, hash-verified

108
109 #[track_caller]
110 pub(crate) fn assert_decode_error<T>(
111 bytes: impl Into<Bytes>,
112 expected: &T::Error,
113 context: T::Context,
114 ) where
115 T: Decode + Debug,
116 T::Error: PartialEq,
117 {
118 let mut bytes = bytes.into();
119 let mut buffer = Buffer::new(&mut bytes);
120
121 let result = T::decode(&mut buffer, context).expect_err("should fail to encode");
122
123 let context = result.current_context();
124
125 assert_eq!(*context, *expected);
126 }
127
128 #[track_caller]
129 pub(crate) fn assert_codec<T>(value: &T, context: T::Context)

Callers

nothing calls this directly

Calls 2

current_contextMethod · 0.80
decodeFunction · 0.50

Tested by

no test coverage detected