pub struct JsonCodec;Expand description
Codec for JSON encoding of protobuf messages.
Implementations§
Source§impl JsonCodec
impl JsonCodec
Sourcepub fn content_type() -> &'static str
pub fn content_type() -> &'static str
Get the content type for this codec.
Sourcepub fn encode<M: Serialize>(message: &M) -> Result<Bytes, ConnectError>
pub fn encode<M: Serialize>(message: &M) -> Result<Bytes, ConnectError>
Encode a message to JSON bytes.
Sourcepub fn decode<M: DeserializeOwned>(data: &[u8]) -> Result<M, ConnectError>
pub fn decode<M: DeserializeOwned>(data: &[u8]) -> Result<M, ConnectError>
Decode JSON bytes into a message.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for JsonCodec
impl RefUnwindSafe for JsonCodec
impl Send for JsonCodec
impl Sync for JsonCodec
impl Unpin for JsonCodec
impl UnsafeUnpin for JsonCodec
impl UnwindSafe for JsonCodec
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