#[non_exhaustive]pub enum RustType {
}Expand description
A Rust type expression usable in field/alias position.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Bool
bool.
I32
i32.
I64
i64.
U32
u32.
U64
u64.
F64
f64.
String
String.
Value
serde_json::Value (free-form / empty schema).
Date
chrono::NaiveDate (format: date).
DateTime
chrono::DateTime<chrono::Utc> (format: date-time).
Uuid
uuid::Uuid (format: uuid).
Bytes
Vec<u8> (format: byte/binary).
Vec(Box<RustType>)
Vec<T>.
Map(Box<RustType>)
std::collections::HashMap<String, T>.
Option(Box<RustType>)
Option<T>.
Boxed(Box<RustType>)
Box<T>, added by the recursion pass to give a cyclic type a size.
Nothing in a schema asks for this. lower::recurse inserts it where a
type would otherwise hold itself, directly or through other types.
Named(String)
A reference to a named (generated or external) type.
External
A reference to a type from an import-mapped module: module::Name.
Generated by another run of this generator, so it derives all three
non-serde traits and carries no ForeignDerives.
Verbatim
A verbatim type expression from an x-rust-type extension, with what its
x-rust-derive says the target implements.
Fields
derives: ForeignDerivesWhich of Debug, Clone, PartialEq the target satisfies.
Implementations§
Source§impl RustType
impl RustType
Sourcepub fn is_option(&self) -> bool
pub fn is_option(&self) -> bool
Whether this type is an Option<..> (for which skip_serializing_if = "Option::is_none" is valid).
Sourcepub fn innermost(&self) -> &RustType
pub fn innermost(&self) -> &RustType
The type inside any Option or Box wrapper.
A Vec and a Map are not wrappers here. Each carries keywords of its
own, so a rule reads the collection and not an element.
Trait Implementations§
impl Eq for RustType
impl StructuralPartialEq for RustType
Auto Trait Implementations§
impl Freeze for RustType
impl RefUnwindSafe for RustType
impl Send for RustType
impl Sync for RustType
impl Unpin for RustType
impl UnsafeUnpin for RustType
impl UnwindSafe for RustType
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.