Struct serde_with::Schema

source ·
pub struct Schema<T: ?Sized, TA>(/* private fields */);
Expand description

Helper for implementing JsonSchema on serializers whose output depends on the type of the concrete field.

It is added implicitly by the #[serde_as] macro when any schemars feature is enabled.

Trait Implementations§

source§

impl<T, TA> JsonSchema for Schema<T, TA>
where T: ?Sized, TA: JsonSchemaAs<T>,

Available on crate feature schemars_0_8 only.
source§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
source§

fn json_schema(gen: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
source§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
source§

impl<T, TA> JsonSchema for Schema<Vec<T>, OneOrMany<TA, PreferOne>>
where Schema<T, TA>: JsonSchema,

Available on crate feature schemars_0_8 only.
source§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
source§

fn json_schema(gen: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
source§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
source§

impl<T, TA> JsonSchema for Schema<Vec<T>, OneOrMany<TA, PreferMany>>
where Schema<T, TA>: JsonSchema,

Available on crate feature schemars_0_8 only.
source§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
source§

fn json_schema(gen: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
source§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more

Auto Trait Implementations§

§

impl<T, TA> Freeze for Schema<T, TA>
where T: ?Sized,

§

impl<T, TA> RefUnwindSafe for Schema<T, TA>

§

impl<T, TA> Send for Schema<T, TA>
where T: Send + ?Sized, TA: Send,

§

impl<T, TA> Sync for Schema<T, TA>
where T: Sync + ?Sized, TA: Sync,

§

impl<T, TA> Unpin for Schema<T, TA>
where T: Unpin + ?Sized, TA: Unpin,

§

impl<T, TA> UnwindSafe for Schema<T, TA>
where T: UnwindSafe + ?Sized, TA: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.