#[non_exhaustive]pub struct LocalizedMessage {
pub locale: String,
pub message: String,
}Expand description
Provides a localized error message that is safe to return to the user which can be attached to an RPC error.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.locale: StringThe locale used following the specification defined at https://www.rfc-editor.org/rfc/bcp/bcp47.txt. Examples are: “en-US”, “fr-CH”, “es-MX”
message: StringThe localized error message in the above locale.
Implementations§
Source§impl LocalizedMessage
impl LocalizedMessage
Sourcepub fn set_locale<T: Into<String>>(self, v: T) -> Self
pub fn set_locale<T: Into<String>>(self, v: T) -> Self
Sets the value of locale.
Sourcepub fn set_message<T: Into<String>>(self, v: T) -> Self
pub fn set_message<T: Into<String>>(self, v: T) -> Self
Sets the value of message.
Trait Implementations§
Source§impl Clone for LocalizedMessage
impl Clone for LocalizedMessage
Source§fn clone(&self) -> LocalizedMessage
fn clone(&self) -> LocalizedMessage
Returns a copy of the value. Read more
1.0.0 · 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 LocalizedMessage
impl Debug for LocalizedMessage
Source§impl Default for LocalizedMessage
impl Default for LocalizedMessage
Source§fn default() -> LocalizedMessage
fn default() -> LocalizedMessage
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for LocalizedMessagewhere
LocalizedMessage: Default,
impl<'de> Deserialize<'de> for LocalizedMessagewhere
LocalizedMessage: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Message for LocalizedMessage
impl Message for LocalizedMessage
Source§impl PartialEq for LocalizedMessage
impl PartialEq for LocalizedMessage
Source§impl Serialize for LocalizedMessage
impl Serialize for LocalizedMessage
impl StructuralPartialEq for LocalizedMessage
Auto Trait Implementations§
impl Freeze for LocalizedMessage
impl RefUnwindSafe for LocalizedMessage
impl Send for LocalizedMessage
impl Sync for LocalizedMessage
impl Unpin for LocalizedMessage
impl UnwindSafe for LocalizedMessage
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