pub struct DecodeError { /* private fields */ }Expand description
Decoding failure with original and adjacent version context.
If a V1 record reaches V2 but its V2-to-V3 conversion fails, this error keeps
V1 as the stored version and V2-to-V3 as the failing step.
Error::source exposes the original decoder or conversion error.
Implementations§
Source§impl DecodeError
impl DecodeError
Sourcepub fn unsupported(
stable_name: StableName,
source_version: PayloadVersion,
) -> DecodeError
pub fn unsupported( stable_name: StableName, source_version: PayloadVersion, ) -> DecodeError
Reject an unsupported stored version without inspecting its bytes.
Sourcepub fn decode(
stable_name: StableName,
source_version: PayloadVersion,
error: Error,
) -> DecodeError
pub fn decode( stable_name: StableName, source_version: PayloadVersion, error: Error, ) -> DecodeError
Retain the original JSON decoder error and stored version.
Sourcepub fn upcast<E>(
stable_name: StableName,
source_version: PayloadVersion,
adjacent_from: PayloadVersion,
adjacent_to: PayloadVersion,
error: E,
) -> DecodeError
pub fn upcast<E>( stable_name: StableName, source_version: PayloadVersion, adjacent_from: PayloadVersion, adjacent_to: PayloadVersion, error: E, ) -> DecodeError
Retain an owned conversion error and the failing adjacent versions.
Sourcepub const fn context(&self) -> &DecodeContext
pub const fn context(&self) -> &DecodeContext
Immutable stable name and version context.
Sourcepub fn stable_name(&self) -> &StableName
pub fn stable_name(&self) -> &StableName
Stable name shared by every version of this type.
Sourcepub const fn source_version(&self) -> PayloadVersion
pub const fn source_version(&self) -> PayloadVersion
Original stored payload version, preserved throughout the chain.
Sourcepub const fn adjacent_from(&self) -> Option<PayloadVersion>
pub const fn adjacent_from(&self) -> Option<PayloadVersion>
Failing adjacent predecessor, if conversion started.
Sourcepub const fn adjacent_to(&self) -> Option<PayloadVersion>
pub const fn adjacent_to(&self) -> Option<PayloadVersion>
Failing adjacent destination, if conversion started.
Sourcepub const fn kind(&self) -> DecodeFailureKind
pub const fn kind(&self) -> DecodeFailureKind
Stable decode failure class.
Trait Implementations§
Source§impl Debug for DecodeError
impl Debug for DecodeError
Source§impl Display for DecodeError
impl Display for DecodeError
Source§impl Error for DecodeError
impl Error for DecodeError
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()