Struct actix_web_utils::dtos::message::MessageResource
source · [−]Expand description
This is for sending errors back from requests conveniently. This struct contains an optional key just in case you want to deal with internationalization. It was left as optional just in case you don’t have the time to yet…
Fields
key: Option<String>message: StringImplementations
sourceimpl MessageResource
impl MessageResource
pub fn new_empty() -> MessageResource
pub fn new_from_str(msg: &str) -> MessageResource
sourcepub fn new_from_err<E: Display>(error: E) -> MessageResource
pub fn new_from_err<E: Display>(error: E) -> MessageResource
Just takes any error that implements display (Has a .to_string() method)
pub fn new(key: &str, msg: &str) -> MessageResource
Trait Implementations
sourceimpl Clone for MessageResource
impl Clone for MessageResource
sourcefn clone(&self) -> MessageResource
fn clone(&self) -> MessageResource
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresourceimpl Debug for MessageResource
impl Debug for MessageResource
sourceimpl<'de> Deserialize<'de> for MessageResource
impl<'de> Deserialize<'de> for MessageResource
sourcefn 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
sourceimpl Display for MessageResource
impl Display for MessageResource
sourceimpl ReturnableErrorShape for MessageResource
impl ReturnableErrorShape for MessageResource
fn convert_to_returnable<T: Serialize>(
&self,
status_code: u16
) -> TypedHttpResponse<T>
sourceimpl Serialize for MessageResource
impl Serialize for MessageResource
Auto Trait Implementations
impl RefUnwindSafe for MessageResource
impl Send for MessageResource
impl Sync for MessageResource
impl Unpin for MessageResource
impl UnwindSafe for MessageResource
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more