Struct PayloadConfig
pub struct PayloadConfig { /* private fields */ }
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.
Implementations§
§impl PayloadConfig
impl PayloadConfig
pub 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.
pub 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.
pub 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§
§impl Clone for PayloadConfig
impl Clone for PayloadConfig
§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 more§impl Default for PayloadConfig
impl Default for PayloadConfig
§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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)