JsonSerializer

Struct JsonSerializer 

Source
pub struct JsonSerializer { /* private fields */ }
Expand description

JSON serializer that implements the ShapeSerializer trait.

Implementations§

Source§

impl JsonSerializer

Source

pub fn new(settings: JsonCodecSettings) -> Self

Creates a new JSON serializer with the given settings.

Trait Implementations§

Source§

impl ShapeSerializer for JsonSerializer

Source§

type Output = Vec<u8>

The serialization target type (e.g., Vec<u8>, String).
Source§

type Error = JsonSerializerError

The error type returned by serialization operations.
Source§

fn finish(self) -> Result<Self::Output, Self::Error>

Finalizes the serialization and returns the serialized output. Read more
Source§

fn write_struct<F>( &mut self, _schema: &dyn Schema, write_members: F, ) -> Result<(), Self::Error>
where F: FnOnce(&mut Self) -> Result<(), Self::Error>,

Writes a structure to the serializer. Read more
Source§

fn write_list<F>( &mut self, _schema: &dyn Schema, write_elements: F, ) -> Result<(), Self::Error>
where F: FnOnce(&mut Self) -> Result<(), Self::Error>,

Writes a list to the serializer. Read more
Source§

fn write_map<F>( &mut self, _schema: &dyn Schema, write_entries: F, ) -> Result<(), Self::Error>
where F: FnOnce(&mut Self) -> Result<(), Self::Error>,

Writes a map to the serializer. Read more
Source§

fn write_boolean( &mut self, _schema: &dyn Schema, value: bool, ) -> Result<(), Self::Error>

Writes a boolean value.
Source§

fn write_byte( &mut self, _schema: &dyn Schema, value: i8, ) -> Result<(), Self::Error>

Writes a byte (i8) value.
Source§

fn write_short( &mut self, _schema: &dyn Schema, value: i16, ) -> Result<(), Self::Error>

Writes a short (i16) value.
Source§

fn write_integer( &mut self, _schema: &dyn Schema, value: i32, ) -> Result<(), Self::Error>

Writes an integer (i32) value.
Source§

fn write_long( &mut self, _schema: &dyn Schema, value: i64, ) -> Result<(), Self::Error>

Writes a long (i64) value.
Source§

fn write_float( &mut self, _schema: &dyn Schema, value: f32, ) -> Result<(), Self::Error>

Writes a float (f32) value.
Source§

fn write_double( &mut self, _schema: &dyn Schema, value: f64, ) -> Result<(), Self::Error>

Writes a double (f64) value.
Source§

fn write_big_integer( &mut self, _schema: &dyn Schema, value: &BigInteger, ) -> Result<(), Self::Error>

Writes a big integer value.
Source§

fn write_big_decimal( &mut self, _schema: &dyn Schema, value: &BigDecimal, ) -> Result<(), Self::Error>

Writes a big decimal value.
Source§

fn write_string( &mut self, _schema: &dyn Schema, value: &str, ) -> Result<(), Self::Error>

Writes a string value.
Source§

fn write_blob( &mut self, _schema: &dyn Schema, value: &Blob, ) -> Result<(), Self::Error>

Writes a blob (byte array) value.
Source§

fn write_timestamp( &mut self, schema: &dyn Schema, value: &DateTime, ) -> Result<(), Self::Error>

Writes a timestamp value.
Source§

fn write_document( &mut self, _schema: &dyn Schema, value: &Document, ) -> Result<(), Self::Error>

Writes a document value.
Source§

fn write_null(&mut self, _schema: &dyn Schema) -> Result<(), Self::Error>

Writes a null value (for sparse collections).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more