Skip to main content

extract_match_arg_default

Function extract_match_arg_default 

Source
pub(crate) fn extract_match_arg_default(raw: &str) -> String
Expand description

Extract the unquoted form of a user-supplied default = "..." literal for a match_arg parameter.

The user writes the value as it appears in R source, so a string default is default = "\"zstd\"" — the String we receive is "zstd" (with the quote chars). Strip the outer quotes if present; otherwise pass the raw value through unchanged. The write-time pass validates the result against the enum’s CHOICES and panics on miss, so a malformed literal (e.g. default = "1L") still surfaces as a clear runtime error at cdylib load.