Skip to main content

apply_return_pref

Function apply_return_pref 

Source
pub(crate) fn apply_return_pref(
    auto: ReturnHandling,
    pref: ReturnPref,
) -> ReturnHandling
Expand description

Maps a ReturnPref attribute value onto an auto-detected ReturnHandling.

Only substitutes the plain IntoR variant with its pref-specific counterpart. All other variants (Unit, RawSexp, ExternalPtr, Result*, OptionIntoR, OptionIntoRUnwrap) are left unchanged — wrapping would be semantically wrong or there is no plain value to wrap.

§Notes

When prefer= is combined with Option<T> or Result<T,E> returns, only the plain-T fast path is affected — Option/Result wrappers behave as if prefer= were absent. A future PR can add explicit Option* handling if a user needs it.