Trait k8s_openapi::Response
source · pub trait Response: Sized {
// Required method
fn try_from_parts(
status_code: StatusCode,
buf: &[u8]
) -> Result<(Self, usize), ResponseError>;
}
Expand description
A trait implemented by all response types corresponding to Kubernetes API functions.
Required Methods§
sourcefn try_from_parts(
status_code: StatusCode,
buf: &[u8]
) -> Result<(Self, usize), ResponseError>
fn try_from_parts( status_code: StatusCode, buf: &[u8] ) -> Result<(Self, usize), ResponseError>
Tries to parse the response from the given status code and response body.
If an instance of Self
can be successfully parsed from the given byte buffer, the instance is returned,
along with the number of bytes used up from the buffer. Remove those bytes from the buffer before calling
this function again.
If the buffer does not contain enough bytes to be able to parse an instance of Self
, the function returns
Err(ResponseError::NeedMoreData)
. Append more bytes into the buffer, then call this function again.
Also see the ResponseBody
type.