Struct actix_web_lab::extract::BodyLimit
source · [−]pub struct BodyLimit<T, const LIMIT: usize = DEFAULT_BODY_LIMIT> { /* private fields */ }
Expand description
Extractor wrapper that limits size of payload used.
Examples
use actix_web::{Responder, get, web::Bytes};
use actix_web_lab::extract::BodyLimit;
const BODY_LIMIT: usize = 1_048_576; // 1MB
#[get("/")]
async fn handler(body: BodyLimit<Bytes, BODY_LIMIT>) -> impl Responder {
let body = body.into_inner();
assert!(body.len() < BODY_LIMIT);
body
}
Implementations
sourceimpl<T, const LIMIT: usize> BodyLimit<T, LIMIT>
impl<T, const LIMIT: usize> BodyLimit<T, LIMIT>
sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Returns inner extracted type.
Trait Implementations
sourceimpl<T, const LIMIT: usize> FromRequest for BodyLimit<T, LIMIT>where
T: FromRequest + 'static,
T::Error: Debug + Display,
impl<T, const LIMIT: usize> FromRequest for BodyLimit<T, LIMIT>where
T: FromRequest + 'static,
T::Error: Debug + Display,
type Error = BodyLimitError<T>
type Error = BodyLimitError<T>
The associated error which can be returned.
sourcefn from_request(req: &HttpRequest, payload: &mut Payload) -> Self::Future
fn from_request(req: &HttpRequest, payload: &mut Payload) -> Self::Future
Create a Self
from request parts asynchronously.
sourcefn extract(req: &HttpRequest) -> Self::Future
fn extract(req: &HttpRequest) -> Self::Future
Create a Self
from request head asynchronously. Read more
sourceimpl<T: PartialEq, const LIMIT: usize> PartialEq<BodyLimit<T, LIMIT>> for BodyLimit<T, LIMIT>
impl<T: PartialEq, const LIMIT: usize> PartialEq<BodyLimit<T, LIMIT>> for BodyLimit<T, LIMIT>
impl<T: Eq, const LIMIT: usize> Eq for BodyLimit<T, LIMIT>
impl<T, const LIMIT: usize> StructuralEq for BodyLimit<T, LIMIT>
impl<T, const LIMIT: usize> StructuralPartialEq for BodyLimit<T, LIMIT>
Auto Trait Implementations
impl<T, const LIMIT: usize> RefUnwindSafe for BodyLimit<T, LIMIT>where
T: RefUnwindSafe,
impl<T, const LIMIT: usize> Send for BodyLimit<T, LIMIT>where
T: Send,
impl<T, const LIMIT: usize> Sync for BodyLimit<T, LIMIT>where
T: Sync,
impl<T, const LIMIT: usize> Unpin for BodyLimit<T, LIMIT>where
T: Unpin,
impl<T, const LIMIT: usize> UnwindSafe for BodyLimit<T, LIMIT>where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more