Struct marked_yaml::FromNodeError
source · pub struct FromNodeError { /* private fields */ }
Available on crate feature
serde
only.Expand description
The error returned by from_node
From here you can get the logical path to the error if one is available, and then via the error: the marker indicating where the error occurred if it’s available. Finally you may extract the error itself.
Implementations§
source§impl FromNodeError
impl FromNodeError
sourcepub fn path(&self) -> Option<&str>
Available on crate feature serde-path
only.
pub fn path(&self) -> Option<&str>
serde-path
only.The logical path representing where the error occurred.
Note: this likely will only ever be Some(value)
if
you enable the serde-path
feature, though the function
itself will be available with the serde
feature.
sourcepub fn into_inner(self) -> Error
pub fn into_inner(self) -> Error
Extract the inner error
Methods from Deref<Target = Error>§
sourcepub fn start_mark(&self) -> Option<Marker>
pub fn start_mark(&self) -> Option<Marker>
Retrieve the start marker if there is one
Most spans which are generated by the loader only have start marks (containers have end marks as well, but these failures) are unlikely to exist here.
const YAML: &str = r#"
bad: float
"#;
#[derive(Deserialize)]
struct Example {
bad: Spanned<f64>,
}
let nodes = parse_yaml(0, YAML).unwrap();
let err = from_node::<Example>(&nodes).err().unwrap();
assert!(matches!(&*err, Error::FloatParseFailure(_,_)));
let mark = err.start_mark().unwrap();
assert_eq!(mark.source(), 0);
assert_eq!(mark.line(), 2);
assert_eq!(mark.column(), 6);
Trait Implementations§
source§impl Debug for FromNodeError
impl Debug for FromNodeError
source§impl Deref for FromNodeError
impl Deref for FromNodeError
source§impl Display for FromNodeError
impl Display for FromNodeError
source§impl From<FromNodeError> for FromYamlError
impl From<FromNodeError> for FromYamlError
source§fn from(value: FromNodeError) -> Self
fn from(value: FromNodeError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for FromNodeError
impl RefUnwindSafe for FromNodeError
impl Send for FromNodeError
impl Sync for FromNodeError
impl Unpin for FromNodeError
impl UnwindSafe for FromNodeError
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