Skip to main content

Module prepared

Module prepared 

Source
Expand description

Preparing an argument whose native borrow depends on the arm its conversion takes (#1504).

An Either borrows through whichever arm converts first, and only the conversion can tell which. A generated wrapper’s alias check first takes both arms (NativeBorrow::either); when that union meets another argument, the wrapper prepares the argument (TryFromSexp::__mx_prepare): the conversion runs once, up to the point where it would build a native reference. An owned arm’s value is kept, so it converts once. A borrowing arm records what it borrows and the arms that lead to it, and builds its reference only after the check passes (TryFromSexp::__mx_materialize, through convert).

Re-exports§

use crate::SEXP; 🔒
use crate::from_r::NativeBorrow; 🔒
use crate::from_r::TryFromSexp; 🔒

Structs§

Arms
The arms a prepared conversion took through nested Eithers, outermost first: bit k is the arm at depth k (set for the right arm).

Enums§

Prepared 👻
An argument’s conversion as a generated wrapper’s alias check leaves it: T’s, whose conversion error is E.

Functions§

convert 👻
Convert an argument that a generated wrapper’s alias check may have prepared. Call it only after the check: a deferred arm builds its reference here.
native_leaf 🔒
The preparation of a native reference conversion whose checks check runs: a passed check defers the reference, a failed one is the error.