[][src]Struct actix_multipart::Multipart

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.

Methods

impl Multipart[src]

pub fn new<S>(headers: &HeaderMap, stream: S) -> Multipart where
    S: Stream<Item = Bytes, Error = PayloadError> + '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 actix_web::{web, HttpResponse, Error};
use actix_multipart as mp;

fn index(payload: mp::Multipart) -> impl Future<Item = HttpResponse, Error = Error> {
    payload.from_err()               // <- get multipart stream for current request
       .and_then(|field| {           // <- iterate over multipart items
           // Field in turn is stream of *Bytes* object
           field.from_err()
               .fold((), |_, chunk| {
                   println!("-- CHUNK: \n{:?}", std::str::from_utf8(&chunk));
                       Ok::<_, Error>(())
                   })
        })
        .fold((), |_, _| Ok::<_, Error>(()))
        .map(|_| HttpResponse::Ok().into())
}

type Error = Error

The associated error which can be returned.

type Future = Result<Multipart, Error>

Future that resolves to a Self

type Config = ()

Configuration for this extractor

impl Stream for Multipart[src]

type Item = Field

The type of item this stream will yield on success.

type Error = MultipartError

The type of error this stream may generate.

Auto Trait Implementations

impl !Send for Multipart

impl Unpin for Multipart

impl !Sync for Multipart

impl !UnwindSafe for Multipart

impl !RefUnwindSafe for Multipart

Blanket Implementations

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

impl<T> From<T> for T[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<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

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

impl<T> Erased for T

impl<T> IntoStream for T where
    T: Stream

type Item = <T as Stream>::Item

type Error = <T as Stream>::Error

type Stream = T

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