serde::json::ser

Struct JsonSerializer

source
pub struct JsonSerializer<W, F> { /* private fields */ }

Implementations§

source§

impl JsonSerializer<(), ()>

source

pub fn new<W, F>(writer: W, formatter: F) -> JsonSerializer<W, F>
where W: Write, F: Formatter<W>,

Trait Implementations§

source§

impl<W: Clone, F: Clone> Clone for JsonSerializer<W, F>

source§

fn clone(&self) -> JsonSerializer<W, F>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<W: Debug, F: Debug> Debug for JsonSerializer<W, F>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a, W, F> Serializer for &'a mut JsonSerializer<W, F>
where W: Write, F: Formatter<W>,

source§

type Ok = ()

source§

type Err = JsonSerializationError

source§

type Bytes = JsonBytesSerializer

source§

type Seq = JsonSequenceSerializer<'a, W, F>

source§

type Map = JsonMapSerializer<'a, W, F>

source§

fn serialize_i128(self, value: i128) -> Result<Self::Ok, Self::Err>

source§

fn serialize_u128(self, value: u128) -> Result<Self::Ok, Self::Err>

source§

fn serialize_f32(self, value: f32) -> Result<Self::Ok, Self::Err>

source§

fn serialize_f64(self, value: f64) -> Result<Self::Ok, Self::Err>

source§

fn serialize_bool(self, value: bool) -> Result<Self::Ok, Self::Err>

source§

fn serialize_str(self, value: &str) -> Result<Self::Ok, Self::Err>

source§

fn serialize_sequence(self) -> Result<Self::Seq, Self::Err>

source§

fn serialize_map(self) -> Result<Self::Map, Self::Err>

source§

fn serialize_none(self) -> Result<Self::Ok, Self::Err>

source§

fn serialize_slice<T: Serialize>( self, value: &[T], ) -> Result<Self::Ok, Self::Err>

source§

fn serialize_unit(self) -> Result<Self::Ok, Self::Err>

source§

fn serialize_byte_seq(self) -> Result<Self::Bytes, Self::Err>

source§

fn serialize_i8(self, value: i8) -> Result<Self::Ok, Self::Err>

source§

fn serialize_i16(self, value: i16) -> Result<Self::Ok, Self::Err>

source§

fn serialize_i32(self, value: i32) -> Result<Self::Ok, Self::Err>

source§

fn serialize_i64(self, value: i64) -> Result<Self::Ok, Self::Err>

source§

fn serialize_u8(self, value: u8) -> Result<Self::Ok, Self::Err>

source§

fn serialize_u16(self, value: u16) -> Result<Self::Ok, Self::Err>

source§

fn serialize_u32(self, value: u32) -> Result<Self::Ok, Self::Err>

source§

fn serialize_u64(self, value: u64) -> Result<Self::Ok, Self::Err>

source§

fn serialize_string(self, value: String) -> Result<Self::Ok, Self::Err>

source§

fn serialize_char(self, value: char) -> Result<Self::Ok, Self::Err>

source§

fn serialize_option<T: Serialize>( self, value: &Option<T>, ) -> Result<Self::Ok, Self::Err>

source§

fn serialize_array<T: Serialize, const N: usize>( self, value: [T; N], ) -> Result<Self::Ok, Self::Err>

source§

fn serialize_vec<T: Serialize>( self, value: &Vec<T>, ) -> Result<Self::Ok, Self::Err>

source§

fn serialize_bytes<T: Serialize>( self, value: &Vec<u8>, ) -> Result<Self::Ok, Self::Err>

Auto Trait Implementations§

§

impl<W, F> Freeze for JsonSerializer<W, F>
where W: Freeze, F: Freeze,

§

impl<W, F> RefUnwindSafe for JsonSerializer<W, F>

§

impl<W, F> Send for JsonSerializer<W, F>
where W: Send, F: Send,

§

impl<W, F> Sync for JsonSerializer<W, F>
where W: Sync, F: Sync,

§

impl<W, F> Unpin for JsonSerializer<W, F>
where W: Unpin, F: Unpin,

§

impl<W, F> UnwindSafe for JsonSerializer<W, F>
where W: UnwindSafe, F: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.