pub struct MappedType {
pub rust_type: String,
pub serde_with: Option<String>,
pub feature: Option<TypeFeature>,
}Expand description
Result of mapping an OpenAPI (type, format) pair to a Rust type.
Fields§
§rust_type: StringThe Rust type as a string, e.g. "String",
"chrono::DateTime<chrono::Utc>".
serde_with: Option<String>Optional #[serde(with = "...")] codec path. The generator
wraps this in a with = "<value>" field attribute.
feature: Option<TypeFeature>Optional crate this mapping introduced. Tracked in
UsedFeatures for the dep advisory (Q2.8).
Implementations§
Source§impl MappedType
impl MappedType
Sourcepub fn plain(rust_type: impl Into<String>) -> Self
pub fn plain(rust_type: impl Into<String>) -> Self
Construct a plain mapping with no codec and no external crate.
Sourcepub fn with_feature(rust_type: impl Into<String>, feature: TypeFeature) -> Self
pub fn with_feature(rust_type: impl Into<String>, feature: TypeFeature) -> Self
Plain mapping that records a feature crate (e.g. for types like
std::net::Ipv4Addr we don’t need a codec but we don’t need a
crate either — this helper is for crates that derive serde
directly on the type).
Sourcepub fn with_codec(
rust_type: impl Into<String>,
codec_path: impl Into<String>,
feature: TypeFeature,
) -> Self
pub fn with_codec( rust_type: impl Into<String>, codec_path: impl Into<String>, feature: TypeFeature, ) -> Self
Mapping that requires a #[serde(with = ...)] codec.
Trait Implementations§
Source§impl Clone for MappedType
impl Clone for MappedType
Source§fn clone(&self) -> MappedType
fn clone(&self) -> MappedType
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for MappedType
impl RefUnwindSafe for MappedType
impl Send for MappedType
impl Sync for MappedType
impl Unpin for MappedType
impl UnsafeUnpin for MappedType
impl UnwindSafe for MappedType
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