pub trait IntoSchema {
// Required methods
fn type_id() -> TypeId;
fn register_in(builder: &mut SchemaBuilder) -> SchemaType;
fn to_value(&self) -> SchemaValue;
}Expand description
Convert a Rust type into a self-contained schema graph and a
SchemaValue tree.
The Rust-SDK default type_id() is derived from
core::any::type_name by replacing :: with . so the identifier
matches the language-independent dotted-FQN form (a.b.c.Xyz, see
§4.20 of the value-type spec). Generic instantiations keep the angle
brackets and normalize their contents the same way:
my_crate::Container<my_crate::user::Profile> becomes
my_crate.Container<my_crate.user.Profile>.
#[schema(named = "shared.foo")] overrides the base name. For a
generic type the derive auto-suffixes the explicit name with the
resolved arguments so each instantiation gets its own definition.
Required Methods§
fn type_id() -> TypeId
fn register_in(builder: &mut SchemaBuilder) -> SchemaType
fn to_value(&self) -> SchemaValue
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl IntoSchema for ()
impl IntoSchema for ()
fn type_id() -> TypeId
fn register_in(_b: &mut SchemaBuilder) -> SchemaType
fn to_value(&self) -> SchemaValue
Source§impl IntoSchema for DateTime<Utc>
impl IntoSchema for DateTime<Utc>
fn type_id() -> TypeId
fn register_in(_b: &mut SchemaBuilder) -> SchemaType
fn to_value(&self) -> SchemaValue
Source§impl IntoSchema for Duration
impl IntoSchema for Duration
fn type_id() -> TypeId
fn register_in(_b: &mut SchemaBuilder) -> SchemaType
fn to_value(&self) -> SchemaValue
Source§impl IntoSchema for PathBuf
impl IntoSchema for PathBuf
fn type_id() -> TypeId
fn register_in(_b: &mut SchemaBuilder) -> SchemaType
fn to_value(&self) -> SchemaValue
Source§impl IntoSchema for String
impl IntoSchema for String
fn type_id() -> TypeId
fn register_in(_b: &mut SchemaBuilder) -> SchemaType
fn to_value(&self) -> SchemaValue
Source§impl IntoSchema for bool
impl IntoSchema for bool
fn type_id() -> TypeId
fn register_in(_b: &mut SchemaBuilder) -> SchemaType
fn to_value(&self) -> SchemaValue
Source§impl IntoSchema for char
impl IntoSchema for char
fn type_id() -> TypeId
fn register_in(_b: &mut SchemaBuilder) -> SchemaType
fn to_value(&self) -> SchemaValue
Source§impl IntoSchema for f32
impl IntoSchema for f32
fn type_id() -> TypeId
fn register_in(_b: &mut SchemaBuilder) -> SchemaType
fn to_value(&self) -> SchemaValue
Source§impl IntoSchema for f64
impl IntoSchema for f64
fn type_id() -> TypeId
fn register_in(_b: &mut SchemaBuilder) -> SchemaType
fn to_value(&self) -> SchemaValue
Source§impl IntoSchema for i8
impl IntoSchema for i8
fn type_id() -> TypeId
fn register_in(_b: &mut SchemaBuilder) -> SchemaType
fn to_value(&self) -> SchemaValue
Source§impl IntoSchema for i16
impl IntoSchema for i16
fn type_id() -> TypeId
fn register_in(_b: &mut SchemaBuilder) -> SchemaType
fn to_value(&self) -> SchemaValue
Source§impl IntoSchema for i32
impl IntoSchema for i32
fn type_id() -> TypeId
fn register_in(_b: &mut SchemaBuilder) -> SchemaType
fn to_value(&self) -> SchemaValue
Source§impl IntoSchema for i64
impl IntoSchema for i64
fn type_id() -> TypeId
fn register_in(_b: &mut SchemaBuilder) -> SchemaType
fn to_value(&self) -> SchemaValue
Source§impl IntoSchema for str
str schema is identical to String, so a &str produces the same
schema graph and value as an owned String. This makes string literals
usable directly as agent parameters without an explicit .to_string().
impl IntoSchema for str
str schema is identical to String, so a &str produces the same
schema graph and value as an owned String. This makes string literals
usable directly as agent parameters without an explicit .to_string().
fn type_id() -> TypeId
fn register_in(_b: &mut SchemaBuilder) -> SchemaType
fn to_value(&self) -> SchemaValue
Source§impl IntoSchema for u8
impl IntoSchema for u8
fn type_id() -> TypeId
fn register_in(_b: &mut SchemaBuilder) -> SchemaType
fn to_value(&self) -> SchemaValue
Source§impl IntoSchema for u16
impl IntoSchema for u16
fn type_id() -> TypeId
fn register_in(_b: &mut SchemaBuilder) -> SchemaType
fn to_value(&self) -> SchemaValue
Source§impl IntoSchema for u32
impl IntoSchema for u32
fn type_id() -> TypeId
fn register_in(_b: &mut SchemaBuilder) -> SchemaType
fn to_value(&self) -> SchemaValue
Source§impl IntoSchema for u64
impl IntoSchema for u64
fn type_id() -> TypeId
fn register_in(_b: &mut SchemaBuilder) -> SchemaType
fn to_value(&self) -> SchemaValue
Source§impl IntoSchema for usize
impl IntoSchema for usize
fn type_id() -> TypeId
fn register_in(_b: &mut SchemaBuilder) -> SchemaType
fn to_value(&self) -> SchemaValue
Source§impl<K, V> IntoSchema for BTreeMap<K, V>where
K: IntoSchema,
V: IntoSchema,
impl<K, V> IntoSchema for BTreeMap<K, V>where
K: IntoSchema,
V: IntoSchema,
fn type_id() -> TypeId
fn register_in(b: &mut SchemaBuilder) -> SchemaType
fn to_value(&self) -> SchemaValue
Source§impl<K, V> IntoSchema for HashMap<K, V>where
K: IntoSchema,
V: IntoSchema,
impl<K, V> IntoSchema for HashMap<K, V>where
K: IntoSchema,
V: IntoSchema,
fn type_id() -> TypeId
fn register_in(b: &mut SchemaBuilder) -> SchemaType
fn to_value(&self) -> SchemaValue
Source§impl<T0, T1, T2, T3, T4, T5, T6, T7> IntoSchema for (T0, T1, T2, T3, T4, T5, T6, T7)where
T0: IntoSchema,
T1: IntoSchema,
T2: IntoSchema,
T3: IntoSchema,
T4: IntoSchema,
T5: IntoSchema,
T6: IntoSchema,
T7: IntoSchema,
impl<T0, T1, T2, T3, T4, T5, T6, T7> IntoSchema for (T0, T1, T2, T3, T4, T5, T6, T7)where
T0: IntoSchema,
T1: IntoSchema,
T2: IntoSchema,
T3: IntoSchema,
T4: IntoSchema,
T5: IntoSchema,
T6: IntoSchema,
T7: IntoSchema,
fn type_id() -> TypeId
fn register_in(b: &mut SchemaBuilder) -> SchemaType
fn to_value(&self) -> SchemaValue
Source§impl<T0, T1, T2, T3, T4, T5, T6> IntoSchema for (T0, T1, T2, T3, T4, T5, T6)where
T0: IntoSchema,
T1: IntoSchema,
T2: IntoSchema,
T3: IntoSchema,
T4: IntoSchema,
T5: IntoSchema,
T6: IntoSchema,
impl<T0, T1, T2, T3, T4, T5, T6> IntoSchema for (T0, T1, T2, T3, T4, T5, T6)where
T0: IntoSchema,
T1: IntoSchema,
T2: IntoSchema,
T3: IntoSchema,
T4: IntoSchema,
T5: IntoSchema,
T6: IntoSchema,
fn type_id() -> TypeId
fn register_in(b: &mut SchemaBuilder) -> SchemaType
fn to_value(&self) -> SchemaValue
Source§impl<T0, T1, T2, T3, T4, T5> IntoSchema for (T0, T1, T2, T3, T4, T5)where
T0: IntoSchema,
T1: IntoSchema,
T2: IntoSchema,
T3: IntoSchema,
T4: IntoSchema,
T5: IntoSchema,
impl<T0, T1, T2, T3, T4, T5> IntoSchema for (T0, T1, T2, T3, T4, T5)where
T0: IntoSchema,
T1: IntoSchema,
T2: IntoSchema,
T3: IntoSchema,
T4: IntoSchema,
T5: IntoSchema,
fn type_id() -> TypeId
fn register_in(b: &mut SchemaBuilder) -> SchemaType
fn to_value(&self) -> SchemaValue
Source§impl<T0, T1, T2, T3, T4> IntoSchema for (T0, T1, T2, T3, T4)
impl<T0, T1, T2, T3, T4> IntoSchema for (T0, T1, T2, T3, T4)
fn type_id() -> TypeId
fn register_in(b: &mut SchemaBuilder) -> SchemaType
fn to_value(&self) -> SchemaValue
Source§impl<T0, T1, T2, T3> IntoSchema for (T0, T1, T2, T3)
impl<T0, T1, T2, T3> IntoSchema for (T0, T1, T2, T3)
fn type_id() -> TypeId
fn register_in(b: &mut SchemaBuilder) -> SchemaType
fn to_value(&self) -> SchemaValue
Source§impl<T0, T1, T2> IntoSchema for (T0, T1, T2)
impl<T0, T1, T2> IntoSchema for (T0, T1, T2)
fn type_id() -> TypeId
fn register_in(b: &mut SchemaBuilder) -> SchemaType
fn to_value(&self) -> SchemaValue
Source§impl<T0, T1> IntoSchema for (T0, T1)where
T0: IntoSchema,
T1: IntoSchema,
impl<T0, T1> IntoSchema for (T0, T1)where
T0: IntoSchema,
T1: IntoSchema,
fn type_id() -> TypeId
fn register_in(b: &mut SchemaBuilder) -> SchemaType
fn to_value(&self) -> SchemaValue
Source§impl<T0> IntoSchema for (T0,)where
T0: IntoSchema,
impl<T0> IntoSchema for (T0,)where
T0: IntoSchema,
fn type_id() -> TypeId
fn register_in(b: &mut SchemaBuilder) -> SchemaType
fn to_value(&self) -> SchemaValue
Source§impl<T, E> IntoSchema for Result<T, E>where
T: IntoSchema,
E: IntoSchema,
impl<T, E> IntoSchema for Result<T, E>where
T: IntoSchema,
E: IntoSchema,
fn type_id() -> TypeId
fn register_in(b: &mut SchemaBuilder) -> SchemaType
fn to_value(&self) -> SchemaValue
Source§impl<T> IntoSchema for &Twhere
T: IntoSchema + ?Sized,
Forward IntoSchema through shared references so that &T values (most
commonly &str string literals) can be used wherever an IntoSchema value
is expected.
impl<T> IntoSchema for &Twhere
T: IntoSchema + ?Sized,
Forward IntoSchema through shared references so that &T values (most
commonly &str string literals) can be used wherever an IntoSchema value
is expected.