Trait copra::codec::MethodCodec
[−]
[src]
pub trait MethodCodec { type Request; type Response; type Error; fn decode(&self, buf: Bytes) -> Result<Self::Request, Self::Error>; fn encode(&self, msg: Self::Response) -> Result<Bytes, Self::Error>; }
Decode/encode messages from raw bytes
Associated Types
type Request
Request message decoded from raw bytes
type Response
Response message for encoding to raw bytes
type Error
Error during decoding or encoding
Required Methods
fn decode(&self, buf: Bytes) -> Result<Self::Request, Self::Error>
Decode message from bytes.
fn encode(&self, msg: Self::Response) -> Result<Bytes, Self::Error>
Encode message to bytes.
Implementors
impl<T, U> MethodCodec for ProtobufCodec<T, U> where
T: Message + MessageStatic,
U: Message, type Request = T; type Response = U; type Error = ProtobufError;