#[non_exhaustive]pub enum ConversionError {
NotImplemented(&'static str),
InvalidSource(String),
UnrepresentableTarget(String),
}Expand description
Reason a conversion can fail.
The NotImplemented variant is the placeholder every
pre-implementation function returns. Subsequent issues
(#2053 iReal→ChordPro, #2061 ChordPro→iReal) replace those
returns with real implementations; new variants are added at
the bottom of the enum to preserve compatibility with code that
matches on the existing variants.
Marked #[non_exhaustive] so adding a new variant in a follow-up
PR is non-breaking for downstream match expressions, matching
the additive-evolution contract documented at the crate root.
§Note for future implementers
Once #2053 / #2061 land, Self::InvalidSource and
Self::UnrepresentableTarget will carry parser-derived,
potentially attacker-controlled text. Implementations SHOULD
truncate or sanitise their messages before constructing these
variants; downstream Display consumers and log forwarders
MUST NOT assume bounded length until that bound is enforced
upstream. (Same pattern as chordsketch_ireal::json::truncate_for_message.)
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NotImplemented(&'static str)
The conversion direction is recognised but not yet
implemented in this crate version. The contained &'static str is the URL of the issue tracking the implementation
so callers can give a useful diagnostic.
InvalidSource(String)
The source value was structurally invalid and could not be
converted at all (distinct from a lossy-but-successful
conversion, which returns Ok with warnings).
UnrepresentableTarget(String)
The conversion would produce a target value that is not representable in the target format (e.g. an out-of-range time signature on the iReal side).
Trait Implementations§
Source§impl Clone for ConversionError
impl Clone for ConversionError
Source§fn clone(&self) -> ConversionError
fn clone(&self) -> ConversionError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ConversionError
impl Debug for ConversionError
Source§impl Display for ConversionError
impl Display for ConversionError
Source§impl Error for ConversionError
impl Error for ConversionError
1.30.0 · 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()
Source§impl PartialEq for ConversionError
impl PartialEq for ConversionError
Source§fn eq(&self, other: &ConversionError) -> bool
fn eq(&self, other: &ConversionError) -> bool
self and other values to be equal, and is used by ==.