Skip to main content

MethodEnumSchema

Trait MethodEnumSchema 

Source
pub trait MethodEnumSchema: JsonSchema {
    // Required methods
    fn method_names() -> &'static [&'static str];
    fn schema_with_consts() -> Value;
}
Expand description

Trait for method enums that can generate schema with const discriminators

Required Methods§

Source

fn method_names() -> &'static [&'static str]

Get all method names as static strings

Source

fn schema_with_consts() -> Value

Generate schema with const values for method discriminators

This takes the base schemars schema and transforms it so that each variant’s “method” field has a const value instead of just type: string.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§