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

source

pub fn new(decl_name: &'static str) -> Self

Create a new field with the given name and kind.

source

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.

source

pub fn flatten(self, flatten: bool) -> Self

Sets the flatten to the given value.

source

pub fn metadata(self, metadata: &'static Metadata) -> Self

Sets the metadata to the field type.

source

pub fn add_source(self, source: Source) -> Self

Add a source to sources list.

source

pub fn aliases(self, aliases: Vec<&'static str>) -> Self

Sets the aliases list to a new value.

source

pub fn add_alias(self, alias: &'static str) -> Self

Add a alias to aliases list.

source

pub fn rename(self, rename: &'static str) -> Self

Sets the rename to the given value.

source

pub fn serde_rename(self, serde_rename: &'static str) -> Self

Sets the rename to the given value.

Trait Implementations§

source§

impl Clone for Field

source§

fn clone(&self) -> Field

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for Field

source§

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

Formats the value using the given formatter. Read more

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<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

source§

fn implicit( self, class: Class, constructed: bool, tag: u32 ) -> TaggedParser<'a, Implicit, Self, E>

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

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

§

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

§

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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more