Trait elasticsearch::http::request::Body
source · pub trait Body {
fn write(&self, bytes: &mut BytesMut) -> Result<(), Error>;
fn bytes(&self) -> Option<Bytes> { ... }
}
Expand description
Body of an API call.
Some Elasticsearch APIs accept a body as part of the API call. Most APIs expect JSON, however, there are some APIs that expect newline-delimited JSON (NDJSON). The Body trait allows modelling different API body implementations.
Required Methods
Provided Methods
sourcefn bytes(&self) -> Option<Bytes>
fn bytes(&self) -> Option<Bytes>
An existing immutable buffer that can be used to avoid having to write to another buffer that will then be written to the request stream.
If this method returns Some
, the bytes must be the same as
those that would be written by Body::write.