pub struct TypedDetail {
pub type_url: String,
pub value: HashMap<String, Value>,
}Expand description
A typed error detail object using ProtoJSON Any representation.
Each detail object carries a @type URL identifying its schema and
a map of additional fields. When serialized to JSON, @type is
flattened into the object alongside the value fields.
Fields§
§type_url: String§value: HashMap<String, Value>Implementations§
Source§impl TypedDetail
impl TypedDetail
pub fn new(type_url: impl Into<String>, value: HashMap<String, Value>) -> Self
Sourcepub fn error_info(
reason: impl Into<String>,
domain: impl Into<String>,
metadata: Option<HashMap<String, String>>,
) -> Self
pub fn error_info( reason: impl Into<String>, domain: impl Into<String>, metadata: Option<HashMap<String, String>>, ) -> Self
Create a google.rpc.ErrorInfo detail.
Sourcepub fn bad_request(field_violations: Vec<FieldViolation>) -> Self
pub fn bad_request(field_violations: Vec<FieldViolation>) -> Self
Create a google.rpc.BadRequest detail with field violations.
Sourcepub fn from_struct(fields: HashMap<String, Value>) -> Self
pub fn from_struct(fields: HashMap<String, Value>) -> Self
Create a typed detail from a struct (arbitrary map).
Trait Implementations§
Source§impl Clone for TypedDetail
impl Clone for TypedDetail
Source§fn clone(&self) -> TypedDetail
fn clone(&self) -> TypedDetail
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TypedDetail
impl Debug for TypedDetail
Source§impl<'de> Deserialize<'de> for TypedDetail
impl<'de> Deserialize<'de> for TypedDetail
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for TypedDetail
impl PartialEq for TypedDetail
Source§fn eq(&self, other: &TypedDetail) -> bool
fn eq(&self, other: &TypedDetail) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for TypedDetail
impl Serialize for TypedDetail
impl StructuralPartialEq for TypedDetail
Auto Trait Implementations§
impl Freeze for TypedDetail
impl RefUnwindSafe for TypedDetail
impl Send for TypedDetail
impl Sync for TypedDetail
impl Unpin for TypedDetail
impl UnsafeUnpin for TypedDetail
impl UnwindSafe for TypedDetail
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more