MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / deserialize

Function deserialize

src/lowertest/src/lib.rs:143–155  ·  view source on GitHub ↗

Deserialize the next `TokenTree` into a `D` object. See [`to_json`] for the object spec syntax. `type_name` should be `D` in string form. `stream_iter` will advance by one `TokenTree` no matter the result.

(
    stream_iter: &mut I,
    type_name: &'static str,
    ctx: &mut C,
)

Source from the content-addressed store, hash-verified

141///
142/// `stream_iter` will advance by one `TokenTree` no matter the result.
143pub fn deserialize<D, I, C>(
144 stream_iter: &mut I,
145 type_name: &'static str,
146 ctx: &mut C,
147) -> Result<D, String>
148where
149 C: TestDeserializeContext,
150 D: DeserializeOwned + MzReflect,
151 I: Iterator<Item = TokenTree>,
152{
153 deserialize_optional(stream_iter, type_name, ctx)?
154 .ok_or_else(|| format!("Empty spec for type {}", type_name))
155}
156
157/// Converts the next part of the stream into JSON deserializable into an object
158/// of type `type_name`.

Callers 1

deserialize_genericFunction · 0.70

Calls 1

deserialize_optionalFunction · 0.85

Tested by

no test coverage detected