pub trait AltReal: Sized + IntoExtPtrSexp {
const CLASS_NAME: &'static str;
const PACKAGE_NAME: &'static str;
// Required methods
fn length(&mut self) -> usize;
fn elt(&mut self, i: usize) -> f64;
// Provided methods
fn copy_to(&mut self, new: &mut [f64], offset: usize) { ... }
fn inspect(&mut self, is_materialized: bool) { ... }
fn into_altrep(self) -> Result<Sexp> { ... }
fn try_from_altrep_ref(x: &RealSexp) -> Result<&Self> { ... }
fn try_from_altrep_mut(
x: &mut RealSexp,
invalidate_cache: bool,
) -> Result<&mut Self> { ... }
fn try_from_altrep(x: RealSexp) -> Result<Self> { ... }
}
Required Associated Constants§
Sourceconst CLASS_NAME: &'static str
const CLASS_NAME: &'static str
Class name to identify the ALTREP class.
Sourceconst PACKAGE_NAME: &'static str
const PACKAGE_NAME: &'static str
Package name to identify the ALTREP class.
Required Methods§
Provided Methods§
Sourcefn copy_to(&mut self, new: &mut [f64], offset: usize)
fn copy_to(&mut self, new: &mut [f64], offset: usize)
Copies the specified range of the data into a new memory. This is used when the ALTREP needs to be materialized.
For example, you can use copy_from_slice()
for more efficient copying
of the values.
Sourcefn inspect(&mut self, is_materialized: bool)
fn inspect(&mut self, is_materialized: bool)
What gets printed when .Internal(inspect(x))
is used.
Sourcefn into_altrep(self) -> Result<Sexp>
fn into_altrep(self) -> Result<Sexp>
Converts the struct into an ALTREP object.
Sourcefn try_from_altrep_ref(x: &RealSexp) -> Result<&Self>
fn try_from_altrep_ref(x: &RealSexp) -> Result<&Self>
Extracts the reference (&T
) of the underlying data.
Sourcefn try_from_altrep_mut(
x: &mut RealSexp,
invalidate_cache: bool,
) -> Result<&mut Self>
fn try_from_altrep_mut( x: &mut RealSexp, invalidate_cache: bool, ) -> Result<&mut Self>
Extracts the mutable reference (&mut T
) of the underlying data.
Sourcefn try_from_altrep(x: RealSexp) -> Result<Self>
fn try_from_altrep(x: RealSexp) -> Result<Self>
Takes the underlying data. After this operation, the external pointer is replaced with a null pointer.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.