Struct Multipart
pub struct Multipart { /* private fields */ }http and multipart only.Expand description
Extractor for multipart/form-data request bodies.
Iterate fields with Multipart::next_field. Per-field limits are
configured via MultipartConfig, either inserted as a request
extension by a layer (the path the extractor reads) or passed to
from_body_with_config for direct use.
Combine multiple configs with MultipartConfig::merge_floor; the
lowest limit per field wins.
Multipart enforces field exclusivity at compile time: each Field
borrows from &mut self, so the previous field must be dropped before the
next is requested.
For producing multipart bodies on the client, see
crate::service::client::multipart.
Implementations§
§impl Multipart
impl Multipart
pub fn from_body(body: Body, boundary: impl Into<String>) -> Multipart
pub fn from_body(body: Body, boundary: impl Into<String>) -> Multipart
Build a Multipart from a body and boundary string with no per-field
limits.
pub fn from_body_with_config(
body: Body,
boundary: impl Into<String>,
config: Option<&MultipartConfig>,
) -> Multipart
pub fn from_body_with_config( body: Body, boundary: impl Into<String>, config: Option<&MultipartConfig>, ) -> Multipart
Build a Multipart from a body and boundary string, applying the
per-field limits in config. Pass None to skip building any
multer::Constraints and use parser defaults.
pub fn from_stream_with_config<S, O, E, B>(
stream: S,
boundary: B,
config: Option<&MultipartConfig>,
) -> Multipart
pub fn from_stream_with_config<S, O, E, B>( stream: S, boundary: B, config: Option<&MultipartConfig>, ) -> Multipart
Construct from any stream of Result<Bytes, _> and a boundary, with the
per-field limits in config. Pass None to skip building any
multer::Constraints and use parser defaults.
pub async fn next_field(&mut self) -> Result<Option<Field<'_>>, MultipartError>
pub async fn next_field(&mut self) -> Result<Option<Field<'_>>, MultipartError>
Yield the next Field in the multipart stream, or None if the
stream is exhausted.
The previous Field must be dropped before this returns; the borrow
checker enforces this.
Trait Implementations§
§impl FromRequest for Multipart
impl FromRequest for Multipart
§type Rejection = MultipartRejection
type Rejection = MultipartRejection
§async fn from_request(
req: Request,
) -> Result<Multipart, <Multipart as FromRequest>::Rejection>
async fn from_request( req: Request, ) -> Result<Multipart, <Multipart as FromRequest>::Rejection>
Auto Trait Implementations§
impl Freeze for Multipart
impl !RefUnwindSafe for Multipart
impl Send for Multipart
impl Sync for Multipart
impl Unpin for Multipart
impl UnsafeUnpin for Multipart
impl !UnwindSafe for Multipart
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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§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> ⓘ
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> ⓘ
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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more§impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
fn rama_try_from(value: T) -> Result<U, <U as RamaTryFrom<T>>::Error>
§impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
type Error = <U as RamaTryFrom<T, CrateMarker>>::Error
fn rama_try_into(self) -> Result<U, <U as RamaTryFrom<T, CrateMarker>>::Error>
§impl<V, F> ValueFormatter<&V> for F
impl<V, F> ValueFormatter<&V> for F
§fn format_value(writer: impl ValueWriter, value: &&V)
fn format_value(writer: impl ValueWriter, value: &&V)
value to writer§impl<V, F> ValueFormatter<Arc<V>> for F
impl<V, F> ValueFormatter<Arc<V>> for F
§fn format_value(writer: impl ValueWriter, value: &Arc<V>)
fn format_value(writer: impl ValueWriter, value: &Arc<V>)
value to writer§impl<V, F> ValueFormatter<Box<V>> for F
impl<V, F> ValueFormatter<Box<V>> for F
§fn format_value(writer: impl ValueWriter, value: &Box<V>)
fn format_value(writer: impl ValueWriter, value: &Box<V>)
value to writer§impl<V, F> ValueFormatter<Cow<'_, V>> for F
impl<V, F> ValueFormatter<Cow<'_, V>> for F
§fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)
fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)
value to writer§impl<V, F> ValueFormatter<Option<V>> for Fwhere
F: ValueFormatter<V> + ?Sized,
impl<V, F> ValueFormatter<Option<V>> for Fwhere
F: ValueFormatter<V> + ?Sized,
§fn format_value(writer: impl ValueWriter, value: &Option<V>)
fn format_value(writer: impl ValueWriter, value: &Option<V>)
value to writer