Macro anterofit::body_map [] [src]

macro_rules! body_map {
    ($($key:expr => $val:expr),+) => { ... };
    (EAGER: $($key:expr => $val:expr),+) => { ... };
}

Serialize a series of key-value pairs as the request body.

The series will be serialized as if it were a map, like HashMap or BTreeMap but with much less restrictive trait bounds: keys must be Display and values must be Serialize; thus, keys will not be deduplicated or appear in any different order than provided.

By default, serialization will be done on the adapter's executor, so the key and value types must be Send + 'static.

If you want to serialize borrowed values or other types which cannot be sent to other threads, use the EAGER: contextual keyword, which will cause the map to be immediately serialized on the current thread.

Overwrites Body

Setting a new body will overwrite any previous body on the request.

Panics

If the request is a GET request (cannot have a body).