#[non_exhaustive]pub enum Error {
Message {
msg: String,
},
Format {
error: Error,
},
IO {
error: Error,
},
Unexpected {
msg: String,
},
InvalidOptions(String),
SingleQuotedRequiresEscaping {
ch: char,
},
}Expand description
Error type used by the YAML serializer.
This type is re-exported as serde_saphyr::SerializeError and
serde_saphyr::ser::Error, and is returned by
the public serialization APIs (for example serde_saphyr::to_string).
It implements serde::ser::Error, which allows user Serialize impls and
Serde derives to report failures via S::Error::custom(...). Such
free‑form messages are stored in the Message variant.
Other variants wrap concrete underlying failures that can occur while serializing:
Formatwraps astd::fmt::Errorproduced when writing to afmt::Writetarget.IOwraps astd::io::Errorproduced when writing to anio::Writetarget.SingleQuotedRequiresEscapingreports aSingleQuotedwrapper value that needs YAML escape sequences and therefore cannot be emitted in single-quoted style.Unexpectedis used internally for invariant violations (e.g., around anchors). It should not normally surface; if it does, please file a bug.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Message
Free-form error.
Format
Wrapper for formatting errors.
IO
Wrapper for I/O errors.
Unexpected
This is used with anchors and should normally not surface, please report bug if it does.
InvalidOptions(String)
Options used would produce invalid YAML (0 indentation, etc)
SingleQuotedRequiresEscaping
A crate::SingleQuoted value contains a character that cannot be represented safely in
YAML single-quoted style.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()