pub struct Codec { /* private fields */ }Expand description
Codec for serializing/deserializing RPC payloads.
Implementations§
Source§impl Codec
impl Codec
pub fn bincode() -> Self
pub fn codec_type(&self) -> CodecType
Sourcepub fn serialize<T: Serialize>(&self, value: &T) -> Result<Vec<u8>, RpcError>
pub fn serialize<T: Serialize>(&self, value: &T) -> Result<Vec<u8>, RpcError>
Serialize a value to bytes.
Sourcepub fn deserialize<T: DeserializeOwned>(
&self,
data: &[u8],
) -> Result<T, RpcError>
pub fn deserialize<T: DeserializeOwned>( &self, data: &[u8], ) -> Result<T, RpcError>
Deserialize bytes to a value.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Codec
impl RefUnwindSafe for Codec
impl Send for Codec
impl Sync for Codec
impl Unpin for Codec
impl UnsafeUnpin for Codec
impl UnwindSafe for Codec
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