Skip to main content

conversion_value_tokens

Function conversion_value_tokens 

Source
pub(crate) fn conversion_value_tokens(
    subject: &ConversionSubject<'_>,
    crate_class: &[String],
    call: &TokenStream,
    span: Span,
) -> TokenStream
Expand description

The conversion_condition_value(...) expression for the error bound as e on subject, with the crate class and call.

With Expected::Literal (the macro knows the R-facing expectation, '<p>' must be <expected>) the prefix is that literal; with Expected::RunTime it is '<p>' must be and the expression’s value. With Expected::FromError the prefix is built on the failure path by condition::conversion_prefix (NULL or ... when nullable) from what the type declares (a #[derive(TryFromSexp)] newtype, the sides of an Either), else what the error may know (__mx_conversion_expectation!(e), #1594), falling back to invalid '<p>' argument.

With Expected::RunTime and Expected::FromError the error may also word the whole message (__mx_conversion_arg_message!(e, quoted)): a match_arg choice error reads as the R-side match_arg check ('mode' should be one of "fast", "slow", #1767), whatever the prefix. Shared by the argument conversions and the sidecar setters.