pub struct JsonSerializer;Available on crate feature
json only.Expand description
The default Serializer: JSON via serde_json. Ships behind the default json
feature; disable it to supply a different wire format (ADR 0010).
use reliar_core::{JsonSerializer, Serializer};
#[derive(serde::Serialize, serde::Deserialize)]
struct Ping;
impl reliar_core::Message for Ping {
const TYPE: &'static str = "ping";
const VERSION: u16 = 1;
}
let serializer = JsonSerializer;
let bytes = serializer.serialize(&Ping)?;
let _: Ping = serializer.deserialize(&bytes)?;
assert_eq!(serializer.content_type().as_str(), "application/json");Trait Implementations§
Source§impl Clone for JsonSerializer
impl Clone for JsonSerializer
Source§fn clone(&self) -> JsonSerializer
fn clone(&self) -> JsonSerializer
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 moreSource§impl Debug for JsonSerializer
impl Debug for JsonSerializer
Source§impl Default for JsonSerializer
impl Default for JsonSerializer
Source§fn default() -> JsonSerializer
fn default() -> JsonSerializer
Returns the “default value” for a type. Read more
Source§impl Serializer for JsonSerializer
impl Serializer for JsonSerializer
Source§fn content_type(&self) -> &ContentType
fn content_type(&self) -> &ContentType
The content type this serializer produces. Populates both
DeliveryMetadata::content_type and a
provider’s content_type column — one value, chosen by the serializer, never by the
call site. Read moreAuto Trait Implementations§
impl Freeze for JsonSerializer
impl RefUnwindSafe for JsonSerializer
impl Send for JsonSerializer
impl Sync for JsonSerializer
impl Unpin for JsonSerializer
impl UnsafeUnpin for JsonSerializer
impl UnwindSafe for JsonSerializer
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