Struct ValueSerializer
struct ValueSerializer<'d> { ... }
Serialization for TOML [values][crate::Value].
This structure implements serialization support for TOML to serialize an arbitrary type to TOML. Note that the TOML format does not support all datatypes in Rust, such as enums, tuples, and tuple structs. These types will generate an error when serialized.
Currently a serializer always writes its output to an in-memory String,
which is passed in when creating the serializer itself.
Examples
use Serialize;
let config = Config ;
let mut value = Stringnew;
serialize.unwrap;
println!
Implementations
impl<'d> ValueSerializer<'d>
fn new(dst: &'d mut String) -> SelfCreates a new serializer which will emit TOML into the buffer provided.
The serializer can then be used to serialize a type after which the data will be present in
dst.
impl<'d> Freeze for ValueSerializer<'d>
impl<'d> RefUnwindSafe for ValueSerializer<'d>
impl<'d> Send for ValueSerializer<'d>
impl<'d> Serializer for ValueSerializer<'d>
fn serialize_bool(self: Self, v: bool) -> Result<<Self as >::Ok, <Self as >::Error>fn serialize_i8(self: Self, v: i8) -> Result<<Self as >::Ok, <Self as >::Error>fn serialize_i16(self: Self, v: i16) -> Result<<Self as >::Ok, <Self as >::Error>fn serialize_i32(self: Self, v: i32) -> Result<<Self as >::Ok, <Self as >::Error>fn serialize_i64(self: Self, v: i64) -> Result<<Self as >::Ok, <Self as >::Error>fn serialize_u8(self: Self, v: u8) -> Result<<Self as >::Ok, <Self as >::Error>fn serialize_u16(self: Self, v: u16) -> Result<<Self as >::Ok, <Self as >::Error>fn serialize_u32(self: Self, v: u32) -> Result<<Self as >::Ok, <Self as >::Error>fn serialize_u64(self: Self, v: u64) -> Result<<Self as >::Ok, <Self as >::Error>fn serialize_f32(self: Self, v: f32) -> Result<<Self as >::Ok, <Self as >::Error>fn serialize_f64(self: Self, v: f64) -> Result<<Self as >::Ok, <Self as >::Error>fn serialize_char(self: Self, v: char) -> Result<<Self as >::Ok, <Self as >::Error>fn serialize_str(self: Self, v: &str) -> Result<<Self as >::Ok, <Self as >::Error>fn serialize_bytes(self: Self, value: &[u8]) -> Result<<Self as >::Ok, <Self as >::Error>fn serialize_none(self: Self) -> Result<<Self as >::Ok, <Self as >::Error>fn serialize_some<T>(self: Self, value: &T) -> Result<<Self as >::Ok, <Self as >::Error> where T: Serialize + ?Sizedfn serialize_unit(self: Self) -> Result<<Self as >::Ok, <Self as >::Error>fn serialize_unit_struct(self: Self, name: &'static str) -> Result<<Self as >::Ok, <Self as >::Error>fn serialize_unit_variant(self: Self, _name: &'static str, _variant_index: u32, variant: &'static str) -> Result<<Self as >::Ok, <Self as >::Error>fn serialize_newtype_struct<T>(self: Self, _name: &'static str, value: &T) -> Result<<Self as >::Ok, <Self as >::Error> where T: Serialize + ?Sizedfn serialize_newtype_variant<T>(self: Self, _name: &'static str, _variant_index: u32, variant: &'static str, value: &T) -> Result<<Self as >::Ok, <Self as >::Error> where T: Serialize + ?Sizedfn serialize_seq(self: Self, len: Option<usize>) -> Result<<Self as >::SerializeSeq, <Self as >::Error>fn serialize_tuple(self: Self, len: usize) -> Result<<Self as >::SerializeTuple, <Self as >::Error>fn serialize_tuple_struct(self: Self, _name: &'static str, len: usize) -> Result<<Self as >::SerializeTupleStruct, <Self as >::Error>fn serialize_tuple_variant(self: Self, _name: &'static str, _variant_index: u32, variant: &'static str, len: usize) -> Result<<Self as >::SerializeTupleVariant, <Self as >::Error>fn serialize_map(self: Self, _len: Option<usize>) -> Result<<Self as >::SerializeMap, <Self as >::Error>fn serialize_struct(self: Self, name: &'static str, _len: usize) -> Result<<Self as >::SerializeStruct, <Self as >::Error>fn serialize_struct_variant(self: Self, _name: &'static str, _variant_index: u32, variant: &'static str, len: usize) -> Result<<Self as >::SerializeStructVariant, <Self as >::Error>
impl<'d> Sync for ValueSerializer<'d>
impl<'d> Unpin for ValueSerializer<'d>
impl<'d> UnsafeUnpin for ValueSerializer<'d>
impl<'d> UnwindSafe for ValueSerializer<'d>
impl<T> Any for ValueSerializer<'d>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for ValueSerializer<'d>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for ValueSerializer<'d>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> From for ValueSerializer<'d>
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into for ValueSerializer<'d>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for ValueSerializer<'d>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for ValueSerializer<'d>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>