Struct actix_multipart::Multipart[][src]

pub struct Multipart { /* fields omitted */ }

The server-side implementation of multipart/form-data requests.

This will parse the incoming stream into MultipartItem instances via its Stream implementation. MultipartItem::Field contains multipart field. MultipartItem::Multipart is used for nested multipart streams.

Implementations

impl Multipart[src]

pub fn new<S>(headers: &HeaderMap, stream: S) -> Multipart where
    S: Stream<Item = Result<Bytes, PayloadError>> + Unpin + 'static, 
[src]

Create multipart instance for boundary.

Trait Implementations

impl FromRequest for Multipart[src]

Get request's payload as multipart stream

Content-type: multipart/form-data;

Server example

use futures_util::stream::{Stream, StreamExt};
use actix_web::{web, HttpResponse, Error};
use actix_multipart as mp;

async fn index(mut payload: mp::Multipart) -> Result<HttpResponse, Error> {
    // iterate over multipart stream
    while let Some(item) = payload.next().await {
           let mut field = item?;

           // Field in turn is stream of *Bytes* object
           while let Some(chunk) = field.next().await {
               println!("-- CHUNK: \n{:?}", std::str::from_utf8(&chunk?));
           }
    }
    Ok(HttpResponse::Ok().into())
}

type Error = Error

The associated error which can be returned.

type Future = Ready<Result<Multipart, Error>>

Future that resolves to a Self.

type Config = ()

Configuration for this extractor.

impl Stream for Multipart[src]

type Item = Result<Field, MultipartError>

Values yielded by the stream.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> StreamExt for T where
    T: Stream + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<S, T, E> TryStream for S where
    S: Stream<Item = Result<T, E>> + ?Sized

type Ok = T

The type of successful values yielded by this future

type Error = E

The type of failures yielded by this future

impl<S> TryStreamExt for S where
    S: TryStream + ?Sized
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,