GuestToHostResponseExt

Trait GuestToHostResponseExt 

pub trait GuestToHostResponseExt {
    // Required methods
    fn error_code(&self) -> Option<TdispGuestOperationErrorCode>;
    fn type_name(&self) -> Option<&str>;
    fn response<T>(self) -> Result<T, TdispGuestOperationError>
       where T: GuestToHostResponseVariant;
}
Expand description

Provides helper methods for common operations on GuestToHostResponse.

Required Methods§

fn error_code(&self) -> Option<TdispGuestOperationErrorCode>

Returns the error code of the response, if any.

fn type_name(&self) -> Option<&str>

Returns the packet type name of the response.

fn response<T>(self) -> Result<T, TdispGuestOperationError>
where T: GuestToHostResponseVariant,

Consumes the response and returns the inner payload if the result is TdispGuestOperationError::Success and the oneof variant matches T. Returns the error code otherwise.

§Example
let bind = resp.response::<TdispCommandResponseBind>()?;

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§