pub struct TypeSpec<F: Form = MetaForm> { /* private fields */ }Expand description
A type specification.
This contains the actual type as well as an optional compile-time known displayed representation of the type. This is useful for cases where the type is used through a type alias in order to provide information about the alias name.
§Examples
Consider the following Rust function:
fn is_sorted(input: &[i32], pred: Predicate) -> bool;In this above example input would have no displayable name,
preds display name is Predicate and the display name of
the return type is simply bool. Note that Predicate could
simply be a type alias to fn(i32, i32) -> Ordering.
Implementations§
Source§impl TypeSpec
impl TypeSpec
Sourcepub fn with_name_str<T>(display_name: &'static str) -> Selfwhere
T: TypeInfo + 'static,
pub fn with_name_str<T>(display_name: &'static str) -> Selfwhere
T: TypeInfo + 'static,
Sourcepub fn with_name_segs<T, S>(segments: S) -> Self
pub fn with_name_segs<T, S>(segments: S) -> Self
Source§impl<F> TypeSpec<F>where
F: Form,
impl<F> TypeSpec<F>where
F: Form,
Sourcepub fn display_name(&self) -> &DisplayName<F>
pub fn display_name(&self) -> &DisplayName<F>
Returns the compile-time known displayed representation of the type.
Sourcepub fn new(ty: <F as Form>::Type, display_name: DisplayName<F>) -> Self
pub fn new(ty: <F as Form>::Type, display_name: DisplayName<F>) -> Self
Creates a new type specification for a given type and display name.
Trait Implementations§
Source§impl<'de, F: Form> Deserialize<'de> for TypeSpec<F>where
F::Type: DeserializeOwned,
F::String: DeserializeOwned,
impl<'de, F: Form> Deserialize<'de> for TypeSpec<F>where
F::Type: DeserializeOwned,
F::String: DeserializeOwned,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<F: Form + JsonSchema> JsonSchema for TypeSpec<F>
impl<F: Form + JsonSchema> JsonSchema for TypeSpec<F>
Source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref keyword. Read moreimpl<F: Eq + Form> Eq for TypeSpec<F>where
F::Type: Eq,
impl<F: Form> StructuralPartialEq for TypeSpec<F>
Auto Trait Implementations§
impl<F> Freeze for TypeSpec<F>where
<F as Form>::Type: Freeze,
impl<F> RefUnwindSafe for TypeSpec<F>where
<F as Form>::Type: RefUnwindSafe,
<F as Form>::String: RefUnwindSafe,
impl<F> Send for TypeSpec<F>
impl<F> Sync for TypeSpec<F>
impl<F> Unpin for TypeSpec<F>
impl<F> UnwindSafe for TypeSpec<F>where
<F as Form>::Type: UnwindSafe,
<F as Form>::String: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
Consume self to return an equivalent value of
T. Read more§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
The counterpart to
unchecked_from.§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of
T.