Rust

multipart

Module

multipart/form-data request bodies: Parts (form fields, in-memory files, files on disk) encoded between a boundary by Form.

Rust
use utopia_client::multipart::{Form, Part};

let form = Form::with_boundary("abc123", vec![Part::field("name", b"Ada", vec![])]);
assert_eq!(form.content_type(), "multipart/form-data; boundary=abc123");
assert_eq!(
    form.encode()?,
    b"--abc123\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nAda\r\n--abc123--\r\n"
);

Contents

use utopia_client::Error;
Rust
pub struct Error(String)

A part whose file cannot be read.

use utopia_client::multipart::Form;
Rust
pub struct Form

Parts between a boundary: the body of a multipart/form-data request.

use utopia_client::multipart::Part;
Rust
pub struct Part

One part of a multipart body: a form field, an in-memory file, or a file on disk read when the body is encoded.