pub trait Type: Send + Sync {
type RawValueType;
type RawElementValueType;
const IS_REQUIRED: bool;
// Required methods
fn name() -> Cow<'static, str>;
fn schema_ref() -> MetaSchemaRef;
fn as_raw_value(&self) -> Option<&Self::RawValueType>;
fn raw_element_iter<'a>(
&'a self,
) -> Box<dyn Iterator<Item = &'a Self::RawElementValueType> + 'a>;
// Provided methods
fn register(registry: &mut Registry) { ... }
fn is_empty(&self) -> bool { ... }
fn is_none(&self) -> bool { ... }
}
Expand description
Represents an OpenAPI type.
Required Associated Constants§
Sourceconst IS_REQUIRED: bool
const IS_REQUIRED: bool
If it is true
, it means that this type is required.
Required Associated Types§
Sourcetype RawValueType
type RawValueType
The raw type used for validator.
Usually it is Self
, but the wrapper type is its internal type.
For example:
i32::RawValueType
is i32
Option<i32>::RawValueType
is i32
.
Sourcetype RawElementValueType
type RawElementValueType
The raw element type used for validator.
Required Methods§
Sourcefn schema_ref() -> MetaSchemaRef
fn schema_ref() -> MetaSchemaRef
Get schema reference of this type.
Sourcefn as_raw_value(&self) -> Option<&Self::RawValueType>
fn as_raw_value(&self) -> Option<&Self::RawValueType>
Returns a reference to the raw value.
Sourcefn raw_element_iter<'a>(
&'a self,
) -> Box<dyn Iterator<Item = &'a Self::RawElementValueType> + 'a>
fn raw_element_iter<'a>( &'a self, ) -> Box<dyn Iterator<Item = &'a Self::RawElementValueType> + 'a>
Returns an iterator for traversing the elements.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.