StatusExt

Trait StatusExt 

pub trait StatusExt: Sealed {
Show 18 methods // Required methods fn try_with_error_details_and_metadata( code: Code, message: impl Into<ArcStr>, details: ErrorDetails, metadata: MetadataMap, ) -> Result<Status, EncodeError>; fn try_with_error_details( code: Code, message: impl Into<ArcStr>, details: ErrorDetails, ) -> Result<Status, EncodeError>; fn try_with_error_details_vec_and_metadata( code: Code, message: impl Into<ArcStr>, details: impl IntoIterator<Item = ErrorDetail>, metadata: MetadataMap, ) -> Result<Status, EncodeError>; fn try_with_error_details_vec( code: Code, message: impl Into<ArcStr>, details: impl IntoIterator<Item = ErrorDetail>, ) -> Result<Status, EncodeError>; fn check_error_details(&self) -> Result<ErrorDetails, DecodeError>; fn get_error_details(&self) -> ErrorDetails; fn check_error_details_vec(&self) -> Result<Vec<ErrorDetail>, DecodeError>; fn get_error_details_vec(&self) -> Vec<ErrorDetail>; fn get_details_retry_info(&self) -> Option<RetryInfo>; fn get_details_debug_info(&self) -> Option<DebugInfo>; fn get_details_quota_failure(&self) -> Option<QuotaFailure>; fn get_details_error_info(&self) -> Option<ErrorInfo>; fn get_details_precondition_failure(&self) -> Option<PreconditionFailure>; fn get_details_bad_request(&self) -> Option<BadRequest>; fn get_details_request_info(&self) -> Option<RequestInfo>; fn get_details_resource_info(&self) -> Option<ResourceInfo>; fn get_details_help(&self) -> Option<Help>; fn get_details_localized_message(&self) -> Option<LocalizedMessage>;
}
Expand description

Used to implement associated functions and methods on Status, that allow the addition and extraction of standard error details. This trait is sealed and not meant to be implemented outside of rama::grpc::protobuf::types.

Required Methods§

fn try_with_error_details_and_metadata( code: Code, message: impl Into<ArcStr>, details: ErrorDetails, metadata: MetadataMap, ) -> Result<Status, EncodeError>

Generates a Status with error details obtained from an ErrorDetails struct, and custom metadata.

fn try_with_error_details( code: Code, message: impl Into<ArcStr>, details: ErrorDetails, ) -> Result<Status, EncodeError>

Generates a Status with error details obtained from an ErrorDetails struct.

fn try_with_error_details_vec_and_metadata( code: Code, message: impl Into<ArcStr>, details: impl IntoIterator<Item = ErrorDetail>, metadata: MetadataMap, ) -> Result<Status, EncodeError>

Generates a Status with error details provided in a vector of ErrorDetail enums, and custom metadata.

fn try_with_error_details_vec( code: Code, message: impl Into<ArcStr>, details: impl IntoIterator<Item = ErrorDetail>, ) -> Result<Status, EncodeError>

Generates a Status with error details provided in a vector of ErrorDetail enums.

fn check_error_details(&self) -> Result<ErrorDetails, DecodeError>

Can be used to check if the error details contained in Status are malformed or not. Tries to get an ErrorDetails struct from a Status. If some prost::DecodeError occurs, it will be returned. If not debugging, consider using StatusExt::get_error_details or StatusExt::get_error_details_vec.

fn get_error_details(&self) -> ErrorDetails

Get an ErrorDetails struct from Status. If some prost::DecodeError occurs, an empty ErrorDetails struct will be returned.

fn check_error_details_vec(&self) -> Result<Vec<ErrorDetail>, DecodeError>

Can be used to check if the error details contained in Status are malformed or not. Tries to get a vector of ErrorDetail enums from a Status. If some prost::DecodeError occurs, it will be returned. If not debugging, consider using StatusExt::get_error_details_vec or StatusExt::get_error_details.

fn get_error_details_vec(&self) -> Vec<ErrorDetail>

Get a vector of ErrorDetail enums from Status. If some prost::DecodeError occurs, an empty vector will be returned.

fn get_details_retry_info(&self) -> Option<RetryInfo>

Get first RetryInfo details found on Status, if any. If some prost::DecodeError occurs, returns None.

fn get_details_debug_info(&self) -> Option<DebugInfo>

Get first DebugInfo details found on Status, if any. If some prost::DecodeError occurs, returns None.

fn get_details_quota_failure(&self) -> Option<QuotaFailure>

Get first QuotaFailure details found on Status, if any. If some prost::DecodeError occurs, returns None.

fn get_details_error_info(&self) -> Option<ErrorInfo>

Get first ErrorInfo details found on Status, if any. If some prost::DecodeError occurs, returns None.

fn get_details_precondition_failure(&self) -> Option<PreconditionFailure>

Get first PreconditionFailure details found on Status, if any. If some prost::DecodeError occurs, returns None.

fn get_details_bad_request(&self) -> Option<BadRequest>

Get first BadRequest details found on Status, if any. If some prost::DecodeError occurs, returns None.

fn get_details_request_info(&self) -> Option<RequestInfo>

Get first RequestInfo details found on Status, if any. If some prost::DecodeError occurs, returns None.

fn get_details_resource_info(&self) -> Option<ResourceInfo>

Get first ResourceInfo details found on Status, if any. If some prost::DecodeError occurs, returns None.

fn get_details_help(&self) -> Option<Help>

Get first Help details found on Status, if any. If some prost::DecodeError occurs, returns None.

fn get_details_localized_message(&self) -> Option<LocalizedMessage>

Get first LocalizedMessage details found on Status, if any. If some prost::DecodeError occurs, returns None.

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§