Skip to main content

derive_altrep_string

Function derive_altrep_string 

Source
pub fn derive_altrep_string(input: DeriveInput) -> Result<TokenStream>
Expand description

Derive macro entry point for AltrepString.

Auto-implements AltrepLen and AltStringData for a struct with a length field. The elt() method returns Some(self.{elt_field}.as_ref()) as Option<&str> if #[altrep(elt = "...")] is specified, or None (R’s NA_character_) by default.

String ALTREP supports #[altrep(dataptr)] for materialized STRSXP dataptr (via __impl_altvec_string_dataptr) and #[altrep(subset)] for Extract_subset. Note: String dataptr materializes the entire vector into a cached STRSXP in the data2 slot.