#[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):
- Nested enums:
serde_yamlrefuses a newtype variant around another variant (“serializing nested enums in YAML is not supported yet”); oneyaml writes the outer one asName: !Inner ..., which reads back. - Enum around a scalar:
serde_yamlwrites a newtype variant around a number, bool, or null as!Name 1; a custom-tagged scalar always reads back as a string, so oneyaml writesName: 1, which both libraries read back as the variant. - 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. - 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. char:serde_yamlalways single-quotes achar; oneyaml’s data model keeps a char as a string, quoted only when needed.f32layout:serde_yamllays out anf32with ryu’s f32 thresholds (1e14); oneyaml keeps floats asf64and uses the f64 thresholds (100000000000000.0): same digits, same value.
Trait Implementations§
impl Copy for Layout
impl Eq for Layout
impl StructuralPartialEq for Layout
Auto Trait Implementations§
impl Freeze for Layout
impl RefUnwindSafe for Layout
impl Send for Layout
impl Sync for Layout
impl Unpin for Layout
impl UnsafeUnpin for Layout
impl UnwindSafe for Layout
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