Skip to main content

rotate_choices_for_default

Function rotate_choices_for_default 

Source
fn rotate_choices_for_default(
    choices_str: &str,
    preferred: &str,
    placeholder: &str,
) -> String
Expand description

Rotate a comma-separated quoted-choice string so preferred is first.

choices_str has the shape "\"a\", \"b\", \"c\"" (already quoted + joined). preferred is the unquoted user-supplied default (e.g. "b"). On miss, panics with the placeholder name — the cdylib write step is the only caller, so a panic surfaces as a load-time error in the host R session rather than silently producing a broken wrapper.