1use core::fmt;
23/// Indicates that an error occurred during encoding. This is a placeholder
4/// error that can be used by context implementations and is a ZST.
5///
6/// Error details are expected to be reported to the corresponding [`Context`].
7///
8/// [`Context`]: crate::Context
9#[derive(Debug)]
10#[non_exhaustive]
11pub struct ErrorMarker;
1213impl fmt::Display for ErrorMarker {
14#[inline]
15fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
16write!(f, "Error during encoding or decoding (see context)")
17 }
18}
1920impl core::error::Error for ErrorMarker {}
2122#[cfg(test)]
23impl crate::context::ContextError for ErrorMarker {
24#[inline]
25fn custom<T>(_: T) -> Self
26where
27T: 'static + Send + Sync + fmt::Display + fmt::Debug,
28 {
29 ErrorMarker
30 }
3132#[inline]
33fn message<T>(_: T) -> Self
34where
35T: fmt::Display,
36 {
37 ErrorMarker
38 }
39}