pub struct MsgResponse<D> {
pub msg_type: Msg,
pub body: D,
}
Expand description
Instead of returning an enum, we’re returning a struct containing the Msg
type and some body. An advantage to this over the enum method is that there
is no minimum memory size that we must have. This is helpful when some
variants are very large compared to others, as in the case of say
reply::Node vs
reply::Config
Fields§
§msg_type: Msg
§body: D
Implementations§
Source§impl<D> MsgResponse<D>where
D: DeserializeOwned,
MsgResponse
is valid for anything which can be deserialized with serde
impl<D> MsgResponse<D>where
D: DeserializeOwned,
MsgResponse
is valid for anything which can be deserialized with serde
Trait Implementations§
Auto Trait Implementations§
impl<D> Freeze for MsgResponse<D>where
D: Freeze,
impl<D> RefUnwindSafe for MsgResponse<D>where
D: RefUnwindSafe,
impl<D> Send for MsgResponse<D>where
D: Send,
impl<D> Sync for MsgResponse<D>where
D: Sync,
impl<D> Unpin for MsgResponse<D>where
D: Unpin,
impl<D> UnwindSafe for MsgResponse<D>where
D: UnwindSafe,
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