Struct k8s_openapi::ResponseBody[][src]

pub struct ResponseBody<T> {
    pub status_code: StatusCode,
    // some fields omitted
}
Expand description

This struct provides an easy way to parse a byte buffer into a Kubernetes API function’s response.

All API function responses implement the Response trait, and are constructed by calling their Response::try_from_parts function. If this function returns Err(ResponseError::NeedMoreData), that means more bytes need to be appended to the function. Alternatively, if the function returns Ok((value, num_bytes_read)), then num_bytes_read bytes need to be popped off from the front of the buffer.

The ResponseBody struct contains an internal dynamic buffer, and provides append_slice and parse functions to help with this. append_slice appends the slice you give it to its internal buffer, and parse uses the Response::try_from_parts function to parse the response out of the buffer, and truncates it accordingly.

You do not have to use this type to parse the response, say if you want to manage your own byte buffers. You can use <T as Response>::try_from_parts directly instead.

Fields

status_code: StatusCode

The HTTP status code of the response.

Implementations

Construct a value for a response that has the specified HTTP status code.

Append a slice of data from the HTTP response to this buffer.

Try to parse all the data buffered so far into a response type.

Drop the first cnt bytes of this buffer.

This is useful for skipping over malformed bytes, such as invalid utf-8 sequences when parsing streaming String responses like from api::core::v1::Pod::read_namespaced_pod_log.

Panics

This function panics if cnt is greater than the length of the internal buffer.

Trait Implementations

The resulting type after dereferencing.

Dereferences the value.

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

Performs the conversion.

Performs the conversion.

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.