#[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
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
sourceimpl Encoding
impl Encoding
sourcepub fn from_path<P>(path: P) -> Option<Encoding> where
P: AsRef<Path>,
pub fn from_path<P>(path: P) -> Option<Encoding> where
P: AsRef<Path>,
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
sourceimpl ArgEnum for Encoding
impl ArgEnum for Encoding
sourcefn value_variants<'a>() -> &'a [Self]ⓘNotable traits for &'_ mut [u8]impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
fn value_variants<'a>() -> &'a [Self]ⓘNotable traits for &'_ mut [u8]impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
All possible argument values, in display order.
sourcefn to_possible_value<'a>(&self) -> Option<PossibleValue<'a>>
fn to_possible_value<'a>(&self) -> Option<PossibleValue<'a>>
The canonical argument value. Read more
impl Copy for Encoding
impl StructuralPartialEq for Encoding
Auto Trait Implementations
impl RefUnwindSafe for Encoding
impl Send for Encoding
impl Sync for Encoding
impl Unpin for Encoding
impl UnwindSafe for Encoding
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more