Skip to main content

charsxp_to_borrowed_str_or_panic

Function charsxp_to_borrowed_str_or_panic 

Source
pub(crate) unsafe fn charsxp_to_borrowed_str_or_panic(
    charsxp: SEXP,
) -> &'static str
Expand description

Borrow directly from a CHARSXP whose bytes are its UTF-8 text, for a caller that has no Result to return.

Unlike try_charsxp_to_str, this never returns R’s temporary translation buffer. Use it for views whose borrow may be tied to the source STRSXP rather than merely to the enclosing .Call. Panics on a string that needs translation (Latin-1, or native non-ASCII in a session whose locale isn’t UTF-8), and as charsxp_to_str_or_panic does.