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 finish(self) -> Vec<u8>

Finalizes the serialization and returns the output as bytes.

Trait Implementations§

Source§

impl FinishSerializer for JsonSerializer

Source§

fn finish(self) -> Vec<u8>

Consumes the serializer and returns the serialized bytes.
Source§

impl ShapeSerializer for JsonSerializer

Source§

fn write_struct( &mut self, schema: &Schema, value: &dyn SerializableStruct, ) -> Result<(), SerdeError>

Writes a structure to the serializer. Read more
Source§

fn write_list( &mut self, schema: &Schema, write_elements: &dyn Fn(&mut dyn ShapeSerializer) -> Result<(), SerdeError>, ) -> Result<(), SerdeError>

Writes a list to the serializer. Read more
Source§

fn write_map( &mut self, schema: &Schema, write_entries: &dyn Fn(&mut dyn ShapeSerializer) -> Result<(), SerdeError>, ) -> Result<(), SerdeError>

Writes a map to the serializer. Read more
Source§

fn write_boolean( &mut self, schema: &Schema, value: bool, ) -> Result<(), SerdeError>

Writes a boolean value.
Source§

fn write_byte(&mut self, schema: &Schema, value: i8) -> Result<(), SerdeError>

Writes a byte (i8) value.
Source§

fn write_short(&mut self, schema: &Schema, value: i16) -> Result<(), SerdeError>

Writes a short (i16) value.
Source§

fn write_integer( &mut self, schema: &Schema, value: i32, ) -> Result<(), SerdeError>

Writes an integer (i32) value.
Source§

fn write_long(&mut self, schema: &Schema, value: i64) -> Result<(), SerdeError>

Writes a long (i64) value.
Source§

fn write_float(&mut self, schema: &Schema, value: f32) -> Result<(), SerdeError>

Writes a float (f32) value.
Source§

fn write_double( &mut self, schema: &Schema, value: f64, ) -> Result<(), SerdeError>

Writes a double (f64) value.
Source§

fn write_big_integer( &mut self, schema: &Schema, value: &BigInteger, ) -> Result<(), SerdeError>

Writes a big integer value.
Source§

fn write_big_decimal( &mut self, schema: &Schema, value: &BigDecimal, ) -> Result<(), SerdeError>

Writes a big decimal value.
Source§

fn write_string( &mut self, schema: &Schema, value: &str, ) -> Result<(), SerdeError>

Writes a string value.
Source§

fn write_blob( &mut self, schema: &Schema, value: &Blob, ) -> Result<(), SerdeError>

Writes a blob (byte array) value.
Source§

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

Writes a timestamp value.
Source§

fn write_document( &mut self, schema: &Schema, value: &Document, ) -> Result<(), SerdeError>

Writes a document value.
Source§

fn write_null(&mut self, schema: &Schema) -> Result<(), SerdeError>

Writes a null value (for sparse collections).
§

fn write_string_list( &mut self, schema: &Schema, values: &[String], ) -> Result<(), SerdeError>

Writes a list of strings.
§

fn write_blob_list( &mut self, schema: &Schema, values: &[Blob], ) -> Result<(), SerdeError>

Writes a list of blobs.
§

fn write_integer_list( &mut self, schema: &Schema, values: &[i32], ) -> Result<(), SerdeError>

Writes a list of integers.
§

fn write_long_list( &mut self, schema: &Schema, values: &[i64], ) -> Result<(), SerdeError>

Writes a list of longs.
§

fn write_string_string_map( &mut self, schema: &Schema, values: &HashMap<String, String>, ) -> Result<(), SerdeError>

Writes a map with string keys and string values.

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
§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
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