Struct singlefile_formats::toml_serde::Toml
source · pub struct Toml<const PRETTY: bool = true>;
Available on crate feature
toml-serde
only.Expand description
A FileFormat
corresponding to the TOML data format.
Implemented using the toml
crate, only compatible with serde
types.
This type provides an optional constant generic parameter for configuring pretty-print.
Trait Implementations§
source§impl<T, const PRETTY: bool> FileFormat<T> for Toml<PRETTY>where
T: Serialize + DeserializeOwned,
impl<T, const PRETTY: bool> FileFormat<T> for Toml<PRETTY>where
T: Serialize + DeserializeOwned,
Since the toml
crate exposes no writer-based operations, all operations within this implementation are buffered.
§type FormatError = TomlError
type FormatError = TomlError
The type of error to return from
to_writer
and from_reader
.source§fn from_reader<R: Read>(&self, reader: R) -> Result<T, Self::FormatError>
fn from_reader<R: Read>(&self, reader: R) -> Result<T, Self::FormatError>
Deserialize a value from a
Read
stream. Read moresource§fn from_reader_buffered<R: Read>(
&self,
reader: R
) -> Result<T, Self::FormatError>
fn from_reader_buffered<R: Read>( &self, reader: R ) -> Result<T, Self::FormatError>
Identical to
FileFormat::from_reader
, however the provided reader is buffered with BufReader
. Read moresource§fn to_writer<W: Write>(
&self,
writer: W,
value: &T
) -> Result<(), Self::FormatError>
fn to_writer<W: Write>( &self, writer: W, value: &T ) -> Result<(), Self::FormatError>
Serialize a value into a
Write
stream. Read moresource§fn to_writer_buffered<W: Write>(
&self,
writer: W,
value: &T
) -> Result<(), Self::FormatError>
fn to_writer_buffered<W: Write>( &self, writer: W, value: &T ) -> Result<(), Self::FormatError>
Identical to
FileFormat::to_writer
, however the provided writer is buffered with BufWriter
. Read moresource§fn to_buffer(&self, value: &T) -> Result<Vec<u8>, Self::FormatError>
fn to_buffer(&self, value: &T) -> Result<Vec<u8>, Self::FormatError>
Serialize a value into a byte vec.
source§fn from_buffer(&self, buf: &[u8]) -> Result<T, Self::FormatError>
fn from_buffer(&self, buf: &[u8]) -> Result<T, Self::FormatError>
Deserialize a value from a byte vec.
source§impl<const PRETTY: bool> PartialEq for Toml<PRETTY>
impl<const PRETTY: bool> PartialEq for Toml<PRETTY>
impl<const PRETTY: bool> Copy for Toml<PRETTY>
impl<const PRETTY: bool> Eq for Toml<PRETTY>
impl<const PRETTY: bool> StructuralEq for Toml<PRETTY>
impl<const PRETTY: bool> StructuralPartialEq for Toml<PRETTY>
Auto Trait Implementations§
impl<const PRETTY: bool> RefUnwindSafe for Toml<PRETTY>
impl<const PRETTY: bool> Send for Toml<PRETTY>
impl<const PRETTY: bool> Sync for Toml<PRETTY>
impl<const PRETTY: bool> Unpin for Toml<PRETTY>
impl<const PRETTY: bool> UnwindSafe for Toml<PRETTY>
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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.