Skip to main content

Layout

Enum Layout 

Source
#[non_exhaustive]
pub enum Layout { Default, SerdeYaml, }
Expand description

Overall output layout.

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.
§

Default

oneyaml’s own layout: the defaults.

§

SerdeYaml

Reproduce serde_yaml’s output layout, best effort (checked against serde_yaml_ng). Set by Compat::serde_yaml().

Known divergences (each a deliberate choice: correctness first; the oracles crate’s serde_yaml_compat test keeps this list exact):

  1. Nested enums: serde_yaml refuses a newtype variant around another variant (“serializing nested enums in YAML is not supported yet”); oneyaml writes the outer one as Name: !Inner ..., which reads back.
  2. Enum around a scalar: serde_yaml writes a newtype variant around a number, bool, or null as !Name 1; a custom-tagged scalar always reads back as a string, so oneyaml writes Name: 1, which both libraries read back as the variant.
  3. Root indentation indicator: a root string whose first line starts with a space or a line break needs a block indentation indicator; libyaml counts it from 0 (|2) where YAML 1.2 counts from -1 (§8.1.1.1), so readers disagree and oneyaml double-quotes it instead.
  4. U+2028/U+2029: libyaml writes them as line breaks inside single quotes, which YAML 1.2 readers read as other text; oneyaml double-quotes them as \L/\P.
  5. char: serde_yaml always single-quotes a char; oneyaml’s data model keeps a char as a string, quoted only when needed.
  6. f32 layout: serde_yaml lays out an f32 with ryu’s f32 thresholds (1e14); oneyaml keeps floats as f64 and uses the f64 thresholds (100000000000000.0): same digits, same value.

Trait Implementations§

Source§

impl Clone for Layout

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for Layout

Source§

impl Debug for Layout

Source§

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

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

impl Default for Layout

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for Layout

Source§

impl Hash for Layout

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Layout

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Layout

Auto Trait Implementations§

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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.