pub struct BodyWithTimeout { /* private fields */ }
Expand description

Adds a timeout to any Body.

Implementations

Creates a BodyWithTimeout from a hyper::Body.

Panics while reading

If the body was already read more than the max_size or the max_size is 0.

Creates a new BodyWithTimeout leaving the old one, with an empty Body.

Returns the underlying Body.

Note

This removes the timeout.

Returns a reference to the underlying Body.

Returns a mutable reference to the underlying Body.

Note

Calls to the body won’t have a timeout.

Checks if the body is empty.

Note

This only checks if Body is Body::Empty.

Sets a read size limit to the HyperBody. Returns true if the size limit was set.

Note

Works only with the hyper_body feature.
When the size limit is reached an io::Error::Other with SizeLimitReached is returned.

Panics while reading

If the body was already read more than the max_size or the max_size is 0.

Sets the timeout.

Converts the body into MoreBytes returning an error if reading failed or the size limit was reached.

Converts the body into a Vector.

Note

If possible, avoid this function as it is really inefficient.

Converts the body into a String.

Note

If possible, avoid this function as it is really inefficient.
For tests or quick debugging however it is quite suitable.

Converts the body into to Body::Bytes, returning the slice.

Note

If possible, avoid this function as it is really inefficient.

Writes the entire body to an AsyncWrite implementer.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more