Skip to main content

ConversionErrClassed

Trait ConversionErrClassed 

Source
#[doc(hidden)]
pub trait ConversionErrClassed { // Required method fn __mx_conversion_parts(&self, expected_known: bool) -> ErrParts; }
Expand description

Conversion probe, preferred arm: E: RConditionData.

When an argument fails its TryFromSexp conversion, the generated wrapper calls (&e).__mx_conversion_parts(expected_known) with the three conversion-probe traits in scope (see crate::__mx_conversion_err_parts!). This impl, on E taking &self, matches the receiver &E by value, so a TryFromSexp::Error that implements RConditionData contributes its class vector, message and data. ConversionErrBuiltin matches at the same step for the built-in conversion errors, which never implement RConditionData, so the two never compete. ConversionErrDisplay needs one more auto-ref and is only reached otherwise.

Unlike the Result probe (crate::__mx_result_err_parts!) there is no serde stage and the fallback is Display, not Debug: the generated code has always rendered conversion errors with Display, which every built-in error type (SexpError, MatchArgError, …) implements.

Required Methods§

Source

fn __mx_conversion_parts(&self, expected_known: bool) -> ErrParts

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§