#[non_exhaustive]pub enum SerializeError {
Message {
msg: String,
},
Format {
error: Error,
},
IO {
error: Error,
},
Unexpected {
msg: String,
},
InvalidOptions(String),
SingleQuotedRequiresEscaping {
ch: char,
},
EmptyResolvedTag,
InvalidGlobalTagUri {
tag: String,
},
CoreTypeTagAsEnumVariant {
tag: String,
variant: String,
},
}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.EmptyResolvedTagreports aTaggedwrapper whose explicit resolved tag is empty. UseNoneto represent the absence of a tag.InvalidGlobalTagUrireports a non-localTaggedidentity that is not an absolute URI.CoreTypeTagAsEnumVariantreports a YAML core type tag whose name collides with a non-unit enum variant.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.
EmptyResolvedTag
A crate::Tagged value uses an empty string as an explicit resolved tag identity.
Use None to represent a value without an explicit tag.
InvalidGlobalTagUri
A non-local crate::Tagged identity is not a valid absolute URI.
CoreTypeTagAsEnumVariant
A YAML core type tag cannot act as the discriminator for a same-named non-unit enum variant.
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()
Auto Trait Implementations§
impl !RefUnwindSafe for Error
impl !UnwindSafe for Error
impl Forget for Error
impl Freeze for Error
impl Move for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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 moreimpl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more