Skip to main content

TypeRefStatic

Struct TypeRefStatic 

Source
pub struct TypeRefStatic {
    pub kind: TypeKind,
    pub name: Option<&'static str>,
    pub inner: &'static [TypeRefStatic],
    pub optional: bool,
    pub nullable: bool,
    pub value: Option<StaticValue>,
}
Expand description

Static type metadata used by proc macros in link-time endpoint registration.

Fields§

§kind: TypeKind

Language-neutral type category.

§name: Option<&'static str>

Primitive/model/enum name, when applicable.

§inner: &'static [TypeRefStatic]

Nested type references for arrays, records, tuples, and unions.

§optional: bool

Whether the value may be omitted.

§nullable: bool

Whether the value may be null.

§value: Option<StaticValue>

Literal value metadata, when applicable.

Implementations§

Source§

impl TypeRefStatic

Source

pub const fn optional(self) -> Self

Return a copy of this metadata with optionality enabled.

Source

pub const fn nullable(self) -> Self

Return a copy of this metadata with nullability enabled.

Source

pub fn to_schema_type_ref(&self) -> TypeRef

Convert static metadata into the canonical schema type reference.

Source

pub const fn primitive(name: &'static str) -> Self

Construct static type metadata for a primitive type.

Source

pub const fn model(name: &'static str) -> Self

Construct static type metadata for a model reference.

Source

pub const fn enum_ref(name: &'static str) -> Self

Construct static type metadata for an enum reference.

Source

pub const fn array(item: &'static [TypeRefStatic]) -> Self

Construct static type metadata for an array item type.

Pass a one-element slice containing the item type.

Source

pub const fn union(members: &'static [TypeRefStatic]) -> Self

Construct static type metadata for a union of member types.

Source

pub const fn literal(value: StaticValue) -> Self

Construct static type metadata for a literal value.

Source

pub const fn any() -> Self

Construct static type metadata for an unconstrained JSON value.

Source

pub const fn void() -> Self

Construct static type metadata for a void return type.

Trait Implementations§

Source§

impl Clone for TypeRefStatic

Source§

fn clone(&self) -> TypeRefStatic

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TypeRefStatic

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for TypeRefStatic

Source§

fn eq(&self, other: &TypeRefStatic) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TypeRefStatic

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

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>,

Source§

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.