Expand description
Lightweight type-introspection helpers shared by parsing and codegen.
StructsΒ§
- Choice
Layers π - The wrappers around the value of a
match_arg/choicesparameter, peeled outermost first:Missing<..>, thenOption<..>, thenEither<T, R>with the choice on the left (a scalar choice, or aseveral_oklist:Either<Vec<T>, R>, #1612). A plainT(or a plainseveral_okcontainer) has none. - Unevaluated
Param π - An unevaluated-argument parameter:
Quoted/Quosure, or either insideMissing<..>(optional).
EnumsΒ§
- Param
Marker π - A by-value parameter marker the macro peels from a parameter type before
any R-side analysis: the parameter converts as the inner type, and the C
wrapper wraps the value (
<ctor>::from_inner(x)) before the call. - Param
Marker πFamily - The decision family a
ParamMarkerbelongs to: a parameter carries at most one marker per family. - Several
OkContainer π - Container family for a
several_okparameter, returned byclassify_several_ok_container. - Unevaluated
Kind π - Which unevaluated-argument marker a parameter takes.
ConstantsΒ§
- MAIN_
THREAD_ πBOUND - Framework type names that hold R memory and are
!Sendby design.
FunctionsΒ§
- call_
marker π - Detect a condition-call marker parameter type:
Callselectswrapperattribution,CallerCallselectscaller. Matched on the last path segment like the visibility markers; a segment carrying generic arguments (Call<T>) is some other type. References and wrappers (&Call,Option<Call>) are not markers: the C wrapper binds the marker by value from its hidden call slot. - choice_
layer_ πname - The layer name (
"Missing"/"Option"/"Either") whentyis itself a layer type, i.e. when it sits where the choice value should be. Used to reject layers in an unsupported order, such asOption<Missing<T>>orEither<Option<T>, R>. - choice_
layers π - Peel the
ChoiceLayersof a choice parameterβs type. - classify_
several_ πok_ container - Classify a
several_okparameter type into one of the four container families and extract its inner element typeT. - either_
arms π (L, R)for anEither<L, R>type (last path segmentEitherwith two type arguments),Nonefor anything else.- erase_
lifetimes π tywith every lifetime replaced by'_, for aletbinding annotation in generated code:&'a [f64]β&'_ [f64]. The binding then names the target type (so the error type of its conversion is known where the wrapper inspects it) without depending on the userβs lifetime parameters being in scope.- first_
type_ πargument - Returns the first generic type argument from a path segment.
- is_
lazy_ πdots_ marker - Detect the unforced-dots parameter type,
LazyDots: matched on the last path segment like the other markers, bare or with lifetime arguments only (LazyDots<'_>). Only the whole type by value is the parameter; any other shape (&LazyDots,Option<LazyDots>,Missing<LazyDots>) is refused by the callers throughmentions_lazy_dots. - is_
main_ πthread_ bound_ input - Returns
trueiftyis an input type bound to the R main thread. - is_
main_ πthread_ bound_ return - Returns
trueiftyis (or contains) a main-thread-bound type anywhere in a return position β e.g.BuiltDataFrame,Result<BuiltDataFrame, String>,Option<DataFrameShape>,Vec<BuiltDataFrame>. - is_
nargs_ πmarker - Detect the argument-count marker parameter type,
NArgs: matched on the last path segment likecall_marker, with no generic arguments. References and wrappers (&NArgs,Option<NArgs>) are not the marker. - is_
option_ πtype truewhen the last path segment oftyisOption<...>.- is_
rng_ πguard_ param - Detect the RNG guard parameter type,
&RngGuard(a shared reference to a path whose last segment isRngGuard, with no generic arguments, any lifetime). Under#[miniextendr(rng)]the parameter is no R formal: the wrapper has loaded Rβs RNG state and passes its guard at that position. - is_
rooted_ πreference - Explicit shared reference forms whose main-thread conversions borrow a root:
the references, their
Options, andVecs of either (nestedVecs too). Keep worker selection separate:&struses owned storage on the worker, while mutable/custom references still need their existing conversion path. - is_
rooted_ πview - Conversions selected from the rooted call argument rather than a raw SEXP. The Cow vector cases are character vectors, not arbitrary lists of views.
- is_
sexp_ πtype - Returns
trueiftyis syntacticallySEXP. - marker_
in_ πfamily - Whether any of
markersis infamily, and which. - match_
arg_ πchoices_ ty - Resolve the
MatchArg-bound type behind amatch_argparameter. - mentions_
lazy_ πdots - Whether
tynamesLazyDotsanywhere, at any depth. - mentions_
rng_ πguard - Whether
tynamesRngGuardanywhere: a parameter that does without beingis_rng_guard_param(&mut RngGuard,RngGuardby value,Option<&RngGuard>) is a shape the wrapper cannot fill. - mentions_
unevaluated_ πmarker - Whether
tynamesQuoted/Quosureanywhere, at any depth. - nested_
param_ πmarker - A marker inside
Option<..>/Missing<..>/Vec<..>/&.., at any depth of those wrappers. - nth_
type_ πargument - Returns the
n-th generic type argument from a path segment. - option_
inner_ πtype - Return
Tfor anOption<T>type,Nonefor anything else. - outer_
param_ πmarker - The marker a typeβs outermost segment names, with its single type
argument. Matched on the last path segment like
peel_visibility_marker; a bareChecked(no type argument) or one with two is not a marker (the fail-safe direction: the type then fails to convert). - peel_
external_ πptr - Return
Tfor anExternalPtr<T>class handle,tyitself otherwise. - peel_
param_ πmarkers - Peel the parameter markers off a parameter type, outermost first: returns
the markers in the order written and the inner type the parameter
converts as.
Checked<Strict<T>>-style stacks of different families peel in one pass; two markers of one family (Checked<Unchecked<T>>) are an error, as is a marker nested insideOption/Missing/Vec/&(at any depth of those), where the conversion has no marker to unwrap. - peel_
return_ πvisibility peel_visibility_markerover a wholesyn::ReturnType: returns the markerβs decision and an owned return type with the marker removed, so the rest of the analysis (Option/Resultshapes,Self, thread strategy) sees exactly what it would without the marker.- peel_
visibility_ πmarker - Peel a return-visibility marker (
Invisible<T>/Visible<T>, matched on the last path segment likeDots/Missing). - prepare_
return_ πvalue - Prepare the value to match the type used by return analysis. Both functions and method/shim paths unwrap visibility before applying serde transport.
- r_
value_ πnoun - How R documentation names a value of type
ty, with its article:"a data frame","a list","a number","a character vector", β¦ Used for theRarm of anEither<T, R>choice parameter in its auto-generated@paramline (One of "a", "b", or a data frame.). A type without an R name falls back to its Rust spelling in code format. - resolve_
visibility π - Resolve the wrapperβs visibility from the three sources, most explicit
first: a return-type marker, then the
invisible/visibleattribute, then the shape default. A marker and an attribute that disagree are an error atspan. - rng_
guard_ πarg - The argument expression for an
&RngGuardparameter: a borrow of a guard made at the call, which the wrapper has loaded the state for and saves itself (the guard saves nothing when it drops). No binding, so no user parameter name can capture it. - second_
type_ πargument - Returns the second generic type argument from a path segment.
- self_
ref_ πmutability - Whether a bare
&Self/&mut Selfparameter is mutable.Nonemeans this is not a Self-reference parameter. - serialize_
return_ πtype - Model
#[miniextendr(serialize)]exactly like a declaredAsSerialize<T>return, after peeling an outer visibility marker. In particular,OptionandResultinside it are serde data, not boundary control flow. - signature_
holds_ πr_ values - Returns
trueif a method signature passes an R value across the call: a main-thread-bound input (an unevaluatedQuoted/QuosureunderMissing<..>too) or a main-thread-bound return. Such a static method stays on the main thread even whenworkerorworker-defaultselects the worker, the rule standalone functions follow. - static_
lifetime π - The first
'staticlifetime written anywhere inty. - static_
rooted_ πview_ binding - A
'staticborrowed parameter (StrVec<'static>,Cow<'static, str>,&'static [T],Option<&'static str>) can never be bound: its root is the callβs argument slot, or on the worker a copy that ends with the call. Returns the statement that bindsidentwith acompile_error!naming the fix, spanned at the lifetime, in place of a borrow-checker error about a generated temporary. The binding keeps the code that usesidentfree of follow-on errors; it does not diverge, so that code draws no unreachable warning. - type_
display π - Render a type the way it is written in Rust source, for user-facing
messages:
AsFromStrVec<i32>,Either<i32, String>,&[f64],&'a str,Option<Vec<String>>. - unevaluated_
param π - Detect an unevaluated-argument parameter type, matched on the last path
segment like the other markers:
Quoted,Quosure, or one of them as the type argument ofMissing<..>. Any other position (Option<Quoted>,&Quoted) is not one;mentions_unevaluated_markerlets the caller refuse it. - vector_
noun π - The R name of a vector with elements of type
elem, if it has one. - visibility_
marker_ πerror - The error for a marker that cannot be honoured: a nested marker
(
Invisible<Visible<T>>), a marker in argument position, or, the mirror case, a parameter marker (Checked<T>/Unchecked<T>) in return position (also inside a visibility marker). - write_
type_ πtokens