pub struct PayloadConfig {
limit: usize,
mimetype: Option<Mime>,
}Expand description
Configuration for request payloads.
Applies to the built-in Bytes and String extractors.
Note that the Payload extractor does not automatically check
conformance with this configuration to allow more flexibility when
building extractors on top of Payload.
By default, the payload size limit is 256kB and there is no mime type condition.
To use this, add an instance of it to your app, scope
or resource through the associated .app_data() method.
Fields§
§limit: usize§mimetype: Option<Mime>Implementations§
Source§impl PayloadConfig
impl PayloadConfig
Sourcepub fn new(limit: usize) -> PayloadConfig
pub fn new(limit: usize) -> PayloadConfig
Create new instance with a size limit (in bytes) and no mime type condition.
Sourcepub fn limit(self, limit: usize) -> PayloadConfig
pub fn limit(self, limit: usize) -> PayloadConfig
Set maximum accepted payload size in bytes. The default limit is 256KiB.
Sourcepub fn mimetype(self, mt: Mime) -> PayloadConfig
pub fn mimetype(self, mt: Mime) -> PayloadConfig
Set required mime type of the request. By default mime type is not enforced.
Trait Implementations§
Source§impl Clone for PayloadConfig
impl Clone for PayloadConfig
Source§fn clone(&self) -> PayloadConfig
fn clone(&self) -> PayloadConfig
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for PayloadConfig
impl Default for PayloadConfig
Source§fn default() -> PayloadConfig
fn default() -> PayloadConfig
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for PayloadConfig
impl RefUnwindSafe for PayloadConfig
impl Send for PayloadConfig
impl Sync for PayloadConfig
impl Unpin for PayloadConfig
impl UnwindSafe for PayloadConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more