Skip to main content

protect

Function protect 

Source
pub unsafe fn protect(x: SEXP) -> TlsRoot
Expand description

Protect a value using the current TLS scope.

§Panics

Panics if called outside of a with_protect_scope block.

§Safety

  • Must be called from the R main thread
  • x must be a valid SEXP
  • Must be called within a with_protect_scope block

§Example

tls::with_protect_scope(|| {
    let x = tls::protect(some_sexp);
    // use x...
})