pub struct Owned<T: RType> { /* private fields */ }Expand description
Owned SEXP, allocated by Rust code.
You could modify object as a slice object, and return it as a R vector.
Once it is created, you should take care about calling R function.
The ideal way is call R functions before it is allocated (e.g., convert all SEXP<T> into &[T])
then allocate only 1 Owned object.
Implementations§
source§impl<T: RType> Owned<T>
impl<T: RType> Owned<T>
sourcepub fn protect(self) -> Protected<T>
pub fn protect(self) -> Protected<T>
This function provides a way to protect any vector from R’s GC You should take care about that, any allocation might recycle the previous allocated vector In the current fasion, we only alloc 1 return vector, thus protect is not necessary In case you want to communicate with R functions, you must convert all your Owned values to the Protected version.
Trait Implementations§
source§impl<T: RType> SExt for Owned<T>
impl<T: RType> SExt for Owned<T>
source§fn new(len: <Self::Data as RType>::New) -> Self
fn new(len: <Self::Data as RType>::New) -> Self
allocate a new SEXP object with length
for
u8 (CHARcrate::libR::SEXP), new with length is not allowed
thus CHARcrate::libR::SEXP accept a String object.source§fn is_correct_type(&self) -> bool
fn is_correct_type(&self) -> bool
check whether the data has the desired type
source§unsafe fn data_unchecked(&self) -> &[<Self::Data as RType>::Data]
unsafe fn data_unchecked(&self) -> &[<Self::Data as RType>::Data]
got the read-only data of a SEXP object
SAFETY: caller should ensure this SEXP has data with Read more
Auto Trait Implementations§
impl<T> Freeze for Owned<T>
impl<T> RefUnwindSafe for Owned<T>where
T: RefUnwindSafe,
impl<T> !Send for Owned<T>
impl<T> !Sync for Owned<T>
impl<T> Unpin for Owned<T>where
T: Unpin,
impl<T> UnwindSafe for Owned<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more