Skip to main content

declared_expectation

Function declared_expectation 

Source
pub(crate) fn declared_expectation(ty: &Type) -> TokenStream
Expand description

The expression, on a conversion failure’s path, for what a parameter of type ty declares when the macro has no wording for it: an Option<String>, with the error bound as e. Only for a type the binding converts with TryFromSexp, whose __MX_EXPECTATION it reads.

An Either (also under Missing) is worded side by side (from_r::either_expectation, expected_arm), so one side the macro does not know no longer leaves the whole parameter without an expectation; any other type is asked for its __MX_EXPECTATION (a #[derive(TryFromSexp)] newtype says what its inner type does). The NULL or of an Option<_> parameter is the prefix’s (nullable).