musli/context/
error_marker.rs1use core::fmt;
2
3#[derive(Debug)]
10#[non_exhaustive]
11pub struct ErrorMarker;
12
13impl fmt::Display for ErrorMarker {
14 #[inline]
15 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
16 write!(f, "Error during encoding or decoding (see context)")
17 }
18}
19
20impl core::error::Error for ErrorMarker {}
21
22impl<A> crate::context::ContextError<A> for ErrorMarker
23where
24 A: crate::Allocator,
25{
26 #[inline]
27 fn custom<T>(_: A, _: T) -> Self
28 where
29 T: 'static + Send + Sync + fmt::Display + fmt::Debug,
30 {
31 ErrorMarker
32 }
33
34 #[inline]
35 fn message<T>(_: A, _: T) -> Self
36 where
37 T: fmt::Display,
38 {
39 ErrorMarker
40 }
41}