pub trait TestDeserializeContext {
    fn override_syntax<I>(
        &mut self,
        first_arg: TokenTree,
        rest_of_stream: &mut I,
        type_name: &str
    ) -> Result<Option<String>, String>
        I: Iterator<Item = TokenTree>
; fn reverse_syntax_override(
        &mut self,
        json: &Value,
        type_name: &str
    ) -> Option<String>; }
Expand description

A trait for extending and/or overriding the default test case syntax.

Note when creating an implementation of this trait that the [proc_macro2::TokenStream] considers:

  • null/true/false to be Idents
  • strings and positive numeric values (like 1 or 1.1) to be Literals.
  • negative numeric values to be a Punct('-') followed by a Literal.

Required methods

Override the way that first_arg is resolved to JSON.

first_arg is the first TokenTree of the TokenStream. rest_of_stream contains a reference to the rest of the stream.

Returns Ok(Some(value)) if first_arg has been resolved. Returns Ok(None) if first_arg should be resolved using the default syntax. If returning Ok(None), the function implementation promises not to advance rest_of_stream.

Converts json back to the extended syntax specified by TestDeserializeContext::override_syntax.

Returns Some(value) if json has been resolved. Returns None is json should be resolved in the default manner.