Struct salvo_core::extract::metadata::Field
source · #[non_exhaustive]pub struct Field {
pub decl_name: &'static str,
pub flatten: bool,
pub sources: Vec<Source>,
pub aliases: Vec<&'static str>,
pub rename: Option<&'static str>,
pub serde_rename: Option<&'static str>,
pub metadata: Option<&'static Metadata>,
}
Expand description
Information about struct field.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.decl_name: &'static str
Field declare name in struct definition.
flatten: bool
Field flatten, this field will extracted from request.
sources: Vec<Source>
Field sources.
aliases: Vec<&'static str>
Field aliaes.
rename: Option<&'static str>
Field rename defined by #[derive(salvo(extract(rename="")))]
.
serde_rename: Option<&'static str>
Field rename defined by #[derive(serde(rename=""))]
.
metadata: Option<&'static Metadata>
Field metadata, this is used for nested extractible types.
Implementations§
source§impl Field
impl Field
sourcepub fn with_sources(decl_name: &'static str, sources: Vec<Source>) -> Self
pub fn with_sources(decl_name: &'static str, sources: Vec<Source>) -> Self
Create a new field with the given name and kind, and the given sources.
sourcepub fn metadata(self, metadata: &'static Metadata) -> Self
pub fn metadata(self, metadata: &'static Metadata) -> Self
Sets the metadata to the field type.
sourcepub fn add_source(self, source: Source) -> Self
pub fn add_source(self, source: Source) -> Self
Add a source to sources list.
sourcepub fn serde_rename(self, serde_rename: &'static str) -> Self
pub fn serde_rename(self, serde_rename: &'static str) -> Self
Sets the rename to the given value.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Field
impl RefUnwindSafe for Field
impl Send for Field
impl Sync for Field
impl Unpin for Field
impl UnwindSafe for Field
Blanket Implementations§
source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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