Skip to main content

ConversionErrBuiltin

Trait ConversionErrBuiltin 

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

Conversion probe, built-in arm: the framework’s own conversion errors (SexpError and the SexpTypeError / SexpClassError / SexpLengthError / SexpNaError it wraps, and MatchArgError), reworded for R users (#1591).

Their Display text is written for the package author: SEXPTYPE names (expected INTSXP, got STRSXP) and a variant prefix (invalid value: ...). The condition message says instead what the argument should have been, with the reason from SexpError::r_reason (got character, got length 2, NA is not allowed, the invalid value’s own text, …) or MatchArgError::r_reason (got "zzz").

expected_known is set by the macro when it knows the argument’s R-facing expectation and puts it in the message prefix ('x' must be a single integer); the reason then does not repeat it. The type names are those of sexptype_name (numeric for a double, list, NULL, …).

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§

Source§

impl ConversionErrBuiltin for MatchArgError

Source§

impl ConversionErrBuiltin for SexpClassError

Source§

impl ConversionErrBuiltin for SexpError

A SexpError also carries the classes and fields of the check refusals (SexpError::Condition) whose reasons its message reports, directly or from an Either arm.

Source§

impl ConversionErrBuiltin for SexpLengthError

Source§

impl ConversionErrBuiltin for SexpNaError

Source§

impl ConversionErrBuiltin for SexpTypeError