pub struct MessageCodec {
pub message_id: u64,
pub encode_msg: fn(&(dyn Any + 'static), Option<&dyn EncodeContext>) -> Result<Bytes, EncodeError>,
pub decode_res: fn(Bytes, Option<&dyn DecodeContext>) -> Result<Box<dyn Any>, DecodeError>,
}Expand description
A codec for a specific message type, containing the message id
(MessageId::ID), an EncodeMsgFn for encoding the message
to bytes, and a DecodeResFn for decoding the message response bytes back to the concrete
message response type.
Fields§
§message_id: u64§encode_msg: fn(&(dyn Any + 'static), Option<&dyn EncodeContext>) -> Result<Bytes, EncodeError>§decode_res: fn(Bytes, Option<&dyn DecodeContext>) -> Result<Box<dyn Any>, DecodeError>Trait Implementations§
Source§impl Clone for MessageCodec
impl Clone for MessageCodec
Source§fn clone(&self) -> MessageCodec
fn clone(&self) -> MessageCodec
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 moreimpl Copy for MessageCodec
Auto Trait Implementations§
impl Freeze for MessageCodec
impl RefUnwindSafe for MessageCodec
impl Send for MessageCodec
impl Sync for MessageCodec
impl Unpin for MessageCodec
impl UnsafeUnpin for MessageCodec
impl UnwindSafe for MessageCodec
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