#[non_exhaustive]pub enum Encoding {
Json,
Yaml,
Toml,
Json5,
Csv,
QueryString,
Xml,
Text,
Gron,
Hcl,
}
Expand description
Encodings supported by this crate.
Not all of the supported encodings are supported to serialize and deserialize into. Some, like hjson only allow deserialization of encoded data but are not able to serialize back into the original representation.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Json
JavaScript Object Notation
Yaml
Yet Another Markup Language
Toml
TOML configuration format
Json5
ES5 JSON
Csv
Comma separated values
QueryString
URL query string
Xml
Extensible Markup Language
Text
Plaintext document
Gron
Gron
Hcl
HCL
Implementations§
Source§impl Encoding
impl Encoding
Sourcepub fn from_path<P>(path: P) -> Option<Encoding>
pub fn from_path<P>(path: P) -> Option<Encoding>
Creates an Encoding
from a path by looking at the file extension.
Returns None
if the extension is absent or if the extension does not match any of the
supported encodings.
Sourcepub fn from_first_line(line: &str) -> Option<Encoding>
pub fn from_first_line(line: &str) -> Option<Encoding>
Tries to detect the Encoding
by looking at the first line of the input.
Returns None
if the encoding cannot be detected from the first line.
Trait Implementations§
impl Copy for Encoding
impl StructuralPartialEq for Encoding
Auto Trait Implementations§
impl Freeze for Encoding
impl RefUnwindSafe for Encoding
impl Send for Encoding
impl Sync for Encoding
impl Unpin for Encoding
impl UnwindSafe for Encoding
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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