Skip to main content

Module match_arg_keys

Module match_arg_keys 

Source
Expand description

Write-time placeholder & symbol-name formatting for the match_arg pipeline.

All four shapes (choices_placeholder, param_doc_placeholder, choices_helper_c_name, choices_helper_def_ident) share the same {c_ident_without_prefix}_{r_param} stem so the cdylibโ€™s write-time pass can correlate them. Keep them together so the shape canโ€™t drift.

The c_ident_without_prefix input has C_ already stripped (or is a stem already, e.g. MyType__method). Callers that have a full c_ident should pass c_ident.trim_start_matches("C_").

All four helpers call c_stem(...) internally so callers may also pass a full c_ident (e.g. "C_my_fn") โ€” the C_ prefix is normalized away.

Functionsยง

c_stem ๐Ÿ”’
choices_entry_tokens ๐Ÿ”’
Emit the MX_MATCH_ARG_CHOICES static + its linkme registration.
choices_helper_c_name ๐Ÿ”’
C symbol name for the helper fn that returns the enumโ€™s choices SEXP, called from the R wrapperโ€™s match.arg prelude.
choices_helper_def_ident ๐Ÿ”’
Rust ident holding the R_CallMethodDef for the match_arg choices helper.
choices_placeholder ๐Ÿ”’
R-side placeholder that the cdylib resolves to a c("a", "b", ...) literal at write time. Substituted by MX_MATCH_ARG_CHOICES entries.
extract_match_arg_default ๐Ÿ”’
Extract the unquoted form of a user-supplied default = "..." literal for a match_arg parameter.
param_doc_entry_tokens ๐Ÿ”’
Emit the MX_MATCH_ARG_PARAM_DOCS static + its linkme registration.
param_doc_placeholder ๐Ÿ”’
R-side placeholder for the @param doc line, substituted by MX_MATCH_ARG_PARAM_DOCS entries at write time. See #210.
placeholder_ident_suffix ๐Ÿ”’
Derive a safe Rust ident from a write-time placeholder string.