pub struct PayloadConfig { /* private fields */ }Expand description
Payload configuration for request’s payload.
Register it with WebAppConfig::set_value()
and App::with_config(). The extractor
does not read the application state, so a config stored in
AppState has no effect.
Implementations§
Source§impl PayloadConfig
impl PayloadConfig
Sourcepub fn limit(self, limit: usize) -> Self
pub fn limit(self, limit: usize) -> Self
Change max size of payload.
By default max size is 256Kb.
Sourcepub fn content_type<F>(self, predicate: F) -> Self
pub fn content_type<F>(self, predicate: F) -> Self
Set predicate for allowed content types.
The predicate receives the request’s parsed Content-Type. A request
without a Content-Type header, or one the predicate rejects, fails
with a content-type error. By default the content type is not checked.
Sourcepub fn mimetype(self, mt: Mime) -> Self
pub fn mimetype(self, mt: Mime) -> Self
Set required mime-type of the request.
This is a shorthand for content_type with a
predicate that accepts only mt. The comparison includes parameters,
such as charset. By default mime type is not enforced.
Trait Implementations§
Source§impl Clone for PayloadConfig
impl Clone for PayloadConfig
Source§impl Debug for PayloadConfig
impl Debug for PayloadConfig
Auto Trait Implementations§
impl !RefUnwindSafe for PayloadConfig
impl !UnwindSafe for PayloadConfig
impl Freeze for PayloadConfig
impl Send for PayloadConfig
impl Sync for PayloadConfig
impl Unpin for PayloadConfig
impl UnsafeUnpin for PayloadConfig
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§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