Skip to main content

BuildSchema

Trait BuildSchema 

Source
pub trait BuildSchema {
    // Required method
    fn build_schema(ctx: &mut SchemaBuilder) -> SchemaNodeContent;

    // Provided methods
    fn type_name() -> Option<&'static str> { ... }
    fn schema_metadata() -> SchemaMetadata { ... }
    fn build_schema_node(ctx: &mut SchemaBuilder) -> SchemaNodeSpec { ... }
}

Required Methods§

Source

fn build_schema(ctx: &mut SchemaBuilder) -> SchemaNodeContent

Build the schema content for this type.

Use ctx.build::<T>() for nested types - this handles caching and recursion automatically.

Provided Methods§

Source

fn type_name() -> Option<&'static str>

The type name for registration in $types namespace.

Return Some("my-type") to register this type as $types.my-type. Return None (default) for inline/anonymous types.

Source

fn schema_metadata() -> SchemaMetadata

Optional metadata for this type’s schema node.

Override to provide description, deprecation status, defaults, or examples.

Source

fn build_schema_node(ctx: &mut SchemaBuilder) -> SchemaNodeSpec

Build the full node specification for this type.

Override this method to set ext_types or type_codegen on the node. The default implementation delegates to build_schema and schema_metadata.

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.

Implementations on Foreign Types§

Source§

impl BuildSchema for &str

Source§

impl BuildSchema for bool

Source§

impl BuildSchema for f32

Source§

impl BuildSchema for f64

Source§

impl BuildSchema for i8

Source§

impl BuildSchema for i16

Source§

impl BuildSchema for i32

Source§

impl BuildSchema for i64

Source§

impl BuildSchema for i128

Source§

impl BuildSchema for isize

Source§

impl BuildSchema for u8

Source§

impl BuildSchema for u16

Source§

impl BuildSchema for u32

Source§

impl BuildSchema for u64

Source§

impl BuildSchema for u128

Source§

impl BuildSchema for ()

Source§

impl BuildSchema for usize

Source§

impl BuildSchema for String

Source§

impl BuildSchema for Text

Source§

impl<A: BuildSchema + 'static> BuildSchema for (A,)

Source§

impl<A: BuildSchema + 'static, B: BuildSchema + 'static> BuildSchema for (A, B)

Source§

impl<A: BuildSchema + 'static, B: BuildSchema + 'static, C: BuildSchema + 'static> BuildSchema for (A, B, C)

Source§

impl<A: BuildSchema + 'static, B: BuildSchema + 'static, C: BuildSchema + 'static, D: BuildSchema + 'static> BuildSchema for (A, B, C, D)

Source§

impl<A: BuildSchema + 'static, B: BuildSchema + 'static, C: BuildSchema + 'static, D: BuildSchema + 'static, E: BuildSchema + 'static> BuildSchema for (A, B, C, D, E)

Source§

impl<A: BuildSchema + 'static, B: BuildSchema + 'static, C: BuildSchema + 'static, D: BuildSchema + 'static, E: BuildSchema + 'static, F: BuildSchema + 'static> BuildSchema for (A, B, C, D, E, F)

Source§

impl<K: BuildSchema + 'static, V: BuildSchema + 'static> BuildSchema for BTreeMap<K, V>

BTreeMap<K, V> is represented as a map

Source§

impl<K: BuildSchema + 'static, V: BuildSchema + 'static> BuildSchema for HashMap<K, V>

HashMap<K, V> is represented as a map

Source§

impl<K: BuildSchema + 'static, V: BuildSchema + 'static> BuildSchema for IndexMap<K, V>

IndexMap<K, V> is represented as a map (preserves insertion order)

Source§

impl<T: BuildSchema + 'static> BuildSchema for Option<T>

Option is represented as a union: some(T) | none(null)

Source§

impl<T: BuildSchema + 'static> BuildSchema for Box<T>

Box delegates to T

Source§

impl<T: BuildSchema + 'static> BuildSchema for Rc<T>

Rc delegates to T

Source§

impl<T: BuildSchema + 'static> BuildSchema for Arc<T>

Arc delegates to T

Source§

impl<T: BuildSchema + 'static> BuildSchema for Vec<T>

Vec is represented as an array with item type T

Source§

impl<T: BuildSchema + 'static, E: BuildSchema + 'static> BuildSchema for Result<T, E>

Result<T, E> is represented as a union: ok(T) | err(E)

Implementors§