Struct headless_lms_server::prelude::web::PayloadConfig
source · 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 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