Struct hedwig::validators::prost::ExactSchemaMatcher[][src]

pub struct ExactSchemaMatcher<T> { /* fields omitted */ }
This is supported on crate feature prost only.
Expand description

A SchemaMatcher which expects all incoming schemas to match exactly one string for the given message type

use hedwig::validators::prost::{ExactSchemaMatcher, SchemaMatcher, SchemaMismatchError};

struct MyMessage {
    // ...
}
let schema = "messages/my-message/my-schema-v1.proto";

let my_matcher = ExactSchemaMatcher::<MyMessage>::new(schema);

assert_eq!(Ok(()), my_matcher.try_match_schema(schema));

let bad_schema = "messages/my-message/my-schema-v2.proto";
assert_eq!(
    Err(SchemaMismatchError::new::<MyMessage>(
        schema,
        bad_schema.to_owned()
    )),
    my_matcher.try_match_schema(bad_schema)
);

Implementations

Create a new schema matcher with the given expected schema

Trait Implementations

This is supported on crate feature prost only.

The error returned when a given schema does not match the message type

This is supported on crate feature prost only.

Check whether messages with the given schema are valid for deserializing into the trait’s generic message type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Wrap the input message T in a tonic::Request

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more