pub trait Input {
// Required method
fn reflectapi_input_type(schema: &mut Typespace) -> TypeReference;
}Expand description
A trait for types that can be used as an input in an API.
Implementing this trait allows a type to be introspected and its structure
added to a Typespace schema. This is essential for automatically generating
API documentation, client-side code, and validation rules for function arguments
and request bodies.
§Derive Macro
In most cases, you should not implement this trait manually. Instead, use the
#[derive(Input)] macro provided by reflectapi to automatically generate
a correct and efficient implementation.
#[derive(Input, Output)]
struct User {
id: u64,
username: String,
password_hash: String,
}Required Methods§
Sourcefn reflectapi_input_type(schema: &mut Typespace) -> TypeReference
fn reflectapi_input_type(schema: &mut Typespace) -> TypeReference
Recursively adds the type definition to the schema and returns a reference to it.
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.