Skip to main content

TypedGenerationKind

Trait TypedGenerationKind 

Source
pub trait TypedGenerationKind:
    Send
    + Sync
    + 'static {
    const TAG: TypedGenerationTag;
    const ALIAS: Option<&'static str> = None;
}
Expand description

Represents marker types that can be used as a type parameter for TypedGeneration.

Generally, an implementation of this will be a zero-sized type that can never be constructed. An empty struct or enum works well for this.

§Implementations

If the schemars08 feature is enabled, and JsonSchema is implemented for a kind T, then TypedGeneration<T> will also implement JsonSchema.

If you have a large number of generation kinds, consider using oxide-generation-macros which comes with several convenience features.

use oxide_generation_macros::impl_typed_generation_kinds;

// Invoke this macro with:
impl_typed_generation_kinds! {
    kinds = {
        User = {},
        Project = {},
        // ...
    },
}

See oxide-generation-macros for more information.

Required Associated Constants§

Source

const TAG: TypedGenerationTag

The corresponding tag for this kind.

The tag forms a runtime representation of this type.

The tag is required to be a static string.

Provided Associated Constants§

Source

const ALIAS: Option<&'static str> = None

A string that corresponds to a type alias for TypedGeneration<Self>, if one is defined.

The type alias must be defined in the same module as Self. This constant is used by the schemars integration to refer to embed a reference to that alias in the schema, if available.

This is usually defined by the oxide-generation-macros crate.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§