#[non_exhaustive]pub struct Compat;Expand description
Implementations§
Source§impl Compat
impl Compat
Sourcepub const fn serde_yaml() -> Settings
pub const fn serde_yaml() -> Settings
Behave like serde_yaml for migration: duplicate keys are tolerated
(last wins, with a warning), the YAML 1.1 integer forms serde_yaml
reads as integers are integers (Settings::yaml11_int_forms:
0b1010, -0x10, +0x10), and output follows serde_yaml’s layout
(non-indented sequences, Layout::SerdeYaml), and typed enums
read and write newtype variants around numbers, bools, and nulls as
tagged scalars (!Square 2.0,
Settings::resolve_tagged_variant_content).
The remaining reading differences from serde_yaml are listed, with
their reasons, in docs/migrating-from-serde-yaml.md.
A preset is a starting point: refine it like any Settings, here
for a docker-compose.yml that relies on merge keys:
use oneyaml_core::{Compat, DuplicateKeys, Layout, Settings};
const COMPOSE: Settings = Compat::serde_yaml().merge_keys(true);
assert_eq!(COMPOSE.get_duplicate_keys(), DuplicateKeys::LastWins);
assert!(COMPOSE.get_yaml11_int_forms() && COMPOSE.get_merge_keys());
assert_eq!(COMPOSE.get_emit().get_layout(), Layout::SerdeYaml);
// Presets never change limits.
assert_eq!(COMPOSE.get_limits(), Settings::new().get_limits());Trait Implementations§
Auto Trait Implementations§
impl Freeze for Compat
impl RefUnwindSafe for Compat
impl Send for Compat
impl Sync for Compat
impl Unpin for Compat
impl UnsafeUnpin for Compat
impl UnwindSafe for Compat
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