pub enum SyntheticFile {
Model(SyntheticModel),
Overrides(SyntheticOverrides),
}Expand description
A parsed YAML document, tagged by its declared kind.
parse_str peeks the version/kind envelope before committing to a
role-specific #[serde(deny_unknown_fields)] struct, so a typo in
kind produces a clear role error instead of a confusing field error.
Variants§
Model(SyntheticModel)
Overrides(SyntheticOverrides)
Implementations§
Source§impl SyntheticFile
impl SyntheticFile
Sourcepub fn parse_str(input: &str) -> Result<Self>
pub fn parse_str(input: &str) -> Result<Self>
Parse a YAML document, validating its version/kind envelope
before deserializing into the matching role-specific struct.
serde_yaml_ng rejects duplicate mapping keys while parsing into
serde_yaml_ng::Value, so that check happens for free here.
Sourcepub fn parse_value(value: Value) -> Result<Self>
pub fn parse_value(value: Value) -> Result<Self>
Parse an already-constructed YAML serde_yaml_ng::Value, such as
one produced by merging a root document with its resolved local
imports (see crate::synthetic::config::ConfigLoader).
Validates the same version/kind envelope as Self::parse_str;
the only difference is that parsing from text is skipped because
the caller already has a Value.
Sourcepub fn into_model(self) -> Result<SyntheticModel>
pub fn into_model(self) -> Result<SyntheticModel>
Consume this document as a model, or error if it is overrides.
Sourcepub fn into_overrides(self) -> Result<SyntheticOverrides>
pub fn into_overrides(self) -> Result<SyntheticOverrides>
Consume this document as overrides, or error if it is a model.
Trait Implementations§
Source§impl Clone for SyntheticFile
impl Clone for SyntheticFile
Source§fn clone(&self) -> SyntheticFile
fn clone(&self) -> SyntheticFile
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for SyntheticFile
impl RefUnwindSafe for SyntheticFile
impl Send for SyntheticFile
impl Sync for SyntheticFile
impl Unpin for SyntheticFile
impl UnsafeUnpin for SyntheticFile
impl UnwindSafe for SyntheticFile
Blanket Implementations§
impl<T> Allocation for T
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
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>
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>
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