Struct extendr_api::wrapper::dataframe::Dataframe
source · pub struct Dataframe<T> {
pub(crate) robj: Robj,
_marker: PhantomData<T>,
}
Expand description
A representation of a typed data.frame
A data.frame
can be created from Rust by using the IntoDataFrameRow
trait
which can be derived for a single struct
that represents a single row.
The type of the row is captured by the marker T
.
Note that at present, you can create a Dataframe<T>
but you cannot extract
T
from the object. <T>
is purely a marker that indicates the struct that
was used to create its rows.
As a result, using Dataframe<T>
as a function argument will not perform
any type checking on the type.
Fields§
§robj: Robj
§_marker: PhantomData<T>
Implementations§
source§impl<T> Dataframe<T>
impl<T> Dataframe<T>
sourcepub fn try_from_values<I: IntoDataFrameRow<T>>(iter: I) -> Result<Self>
pub fn try_from_values<I: IntoDataFrameRow<T>>(iter: I) -> Result<Self>
Use #[derive(IntoDataFrameRow)]
to use this.
Trait Implementations§
source§impl<T> Attributes for Dataframe<T>
impl<T> Attributes for Dataframe<T>
source§fn get_attrib<'a, N>(&self, name: N) -> Option<Robj>
fn get_attrib<'a, N>(&self, name: N) -> Option<Robj>
Get a specific attribute as a borrowed
Robj
if it exists. Read moresource§fn has_attrib<'a, N>(&self, name: N) -> bool
fn has_attrib<'a, N>(&self, name: N) -> bool
Return true if an attribute exists.
source§fn set_attrib<N, V>(&mut self, name: N, value: V) -> Result<&mut Self>
fn set_attrib<N, V>(&mut self, name: N, value: V) -> Result<&mut Self>
Set a specific attribute in-place and return the object. Read more
source§fn names(&self) -> Option<StrIter>
fn names(&self) -> Option<StrIter>
Get the
names
attribute as a string iterator if one exists. Read moresource§fn set_names<T>(&mut self, names: T) -> Result<&mut Self>
fn set_names<T>(&mut self, names: T) -> Result<&mut Self>
Set the
names
attribute from a string iterator. Read moresource§fn dim(&self) -> Option<Integers>
fn dim(&self) -> Option<Integers>
Get the
dim
attribute as an integer iterator if one exists. Read moresource§fn dimnames(&self) -> Option<ListIter>
fn dimnames(&self) -> Option<ListIter>
Get the
dimnames
attribute as a list iterator if one exists. Read moresource§fn class(&self) -> Option<StrIter>
fn class(&self) -> Option<StrIter>
Get the
class
attribute as a string iterator if one exists. Read moresource§fn set_class<T>(&mut self, class: T) -> Result<&mut Self>
fn set_class<T>(&mut self, class: T) -> Result<&mut Self>
Set the
class
attribute from a string iterator, and return the same
object. Read moresource§impl<T> Conversions for Dataframe<T>
impl<T> Conversions for Dataframe<T>
as_*()
source§fn as_language(&self) -> Option<Language>
fn as_language(&self) -> Option<Language>
Convert a language object to a Language wrapper. Read more
source§fn as_pairlist(&self) -> Option<Pairlist>
fn as_pairlist(&self) -> Option<Pairlist>
Convert a pair list object (LISTSXP) to a Pairlist wrapper. Read more
source§fn as_expressions(&self) -> Option<Expressions>
fn as_expressions(&self) -> Option<Expressions>
Convert an expression object (EXPRSXP) to a Expr wrapper. Read more
source§fn as_environment(&self) -> Option<Environment>
fn as_environment(&self) -> Option<Environment>
Convert an environment object (ENVSXP) to a Env wrapper. Read more
source§fn as_function(&self) -> Option<Function>
fn as_function(&self) -> Option<Function>
Convert a function object (CLOSXP) to a Function wrapper. Read more
source§fn as_promise(&self) -> Option<Promise>
fn as_promise(&self) -> Option<Promise>
Get a wrapper for a promise.
source§impl<T> Operators for Dataframe<T>
impl<T> Operators for Dataframe<T>
dollar() etc.
source§impl<T> Rinternals for Dataframe<T>
impl<T> Rinternals for Dataframe<T>
find_var() etc.
source§fn is_logical(&self) -> bool
fn is_logical(&self) -> bool
Return true if this is a boolean (logical) vector
source§fn is_complex(&self) -> bool
fn is_complex(&self) -> bool
Return true if this is a complex vector.
source§fn is_expressions(&self) -> bool
fn is_expressions(&self) -> bool
Return true if this is an expression.
source§fn is_environment(&self) -> bool
fn is_environment(&self) -> bool
Return true if this is an environment.
source§fn is_promise(&self) -> bool
fn is_promise(&self) -> bool
Return true if this is an environment.
source§fn is_external_pointer(&self) -> bool
fn is_external_pointer(&self) -> bool
Return true if this is an expression.
source§fn get_current_srcref(val: i32) -> Robj
fn get_current_srcref(val: i32) -> Robj
Get the source ref.
source§fn get_src_filename(&self) -> Robj
fn get_src_filename(&self) -> Robj
Get the source filename.
source§fn as_character_vector(&self) -> Robj
fn as_character_vector(&self) -> Robj
Convert to a string vector.
source§fn coerce_vector(&self, sexptype: SEXPTYPE) -> Robj
fn coerce_vector(&self, sexptype: SEXPTYPE) -> Robj
Convert to vectors of many kinds.
source§fn pair_to_vector_list(&self) -> Robj
fn pair_to_vector_list(&self) -> Robj
Convert a pairlist (LISTSXP) to a vector list (VECSXP).
source§fn vector_to_pair_list(&self) -> Robj
fn vector_to_pair_list(&self) -> Robj
Convert a vector list (VECSXP) to a pair list (LISTSXP)
source§fn as_character_factor(&self) -> Robj
fn as_character_factor(&self) -> Robj
Convert a factor to a string vector.
source§fn duplicate(&self) -> Robj
fn duplicate(&self) -> Robj
Do a deep copy of this object.
Note that clone() only adds a reference.
source§fn find_function<K: TryInto<Symbol, Error = Error>>(
&self,
key: K,
) -> Result<Robj>
fn find_function<K: TryInto<Symbol, Error = Error>>( &self, key: K, ) -> Result<Robj>
Find a function in an environment ignoring other variables. Read more
source§fn find_var<K: TryInto<Symbol, Error = Error>>(&self, key: K) -> Result<Robj>
fn find_var<K: TryInto<Symbol, Error = Error>>(&self, key: K) -> Result<Robj>
Find a variable in an environment. Read more
source§fn xlengthgets(&self, new_len: usize) -> Result<Robj>
fn xlengthgets(&self, new_len: usize) -> Result<Robj>
Copy a vector and resize it.
See. https://github.com/hadley/r-internals/blob/master/vectors.md
source§fn alloc_vector(sexptype: SEXPTYPE, len: usize) -> Robj
fn alloc_vector(sexptype: SEXPTYPE, len: usize) -> Robj
Allocated an owned object of a certain type.
source§fn is_function(&self) -> bool
fn is_function(&self) -> bool
Return true if this is a function or a primitive (CLOSXP, BUILTINSXP or SPECIALSXP)
source§fn is_integer(&self) -> bool
fn is_integer(&self) -> bool
Return true if this is an integer vector (INTSXP) but not a factor.
source§fn is_language(&self) -> bool
fn is_language(&self) -> bool
Return true if this is a language object (LANGSXP).
source§fn is_pairlist(&self) -> bool
fn is_pairlist(&self) -> bool
Return true if this is NILSXP or LISTSXP.
source§fn is_number(&self) -> bool
fn is_number(&self) -> bool
Return true if this is INTSXP, LGLSXP or REALSXP but not a factor.
source§fn is_primitive(&self) -> bool
fn is_primitive(&self) -> bool
Return true if this is a primitive function BUILTINSXP, SPECIALSXP.
source§fn is_user_binop(&self) -> bool
fn is_user_binop(&self) -> bool
Return true if this is a user defined binop.
source§fn is_vector_atomic(&self) -> bool
fn is_vector_atomic(&self) -> bool
Return true if this is an atomic vector.
source§fn is_vector_list(&self) -> bool
fn is_vector_list(&self) -> bool
Return true if this is a vector list.
source§fn is_vectorizable(&self) -> bool
fn is_vectorizable(&self) -> bool
Return true if this is can be made into a vector.
fn is_missing_arg(&self) -> bool
fn is_unbound_value(&self) -> bool
fn is_package_env(&self) -> bool
fn package_env_name(&self) -> Robj
fn is_namespace_env(&self) -> bool
fn namespace_env_spec(&self) -> Robj
source§fn is_altinteger(&self) -> bool
fn is_altinteger(&self) -> bool
Returns
true
if this is an integer ALTREP object.source§fn is_altreal(&self) -> bool
fn is_altreal(&self) -> bool
Returns
true
if this is an real ALTREP object.source§fn is_altlogical(&self) -> bool
fn is_altlogical(&self) -> bool
Returns
true
if this is an logical ALTREP object.source§fn is_altstring(&self) -> bool
fn is_altstring(&self) -> bool
Returns
true
if this is an integer ALTREP object.source§fn is_altlist(&self) -> bool
fn is_altlist(&self) -> bool
Returns
true
if this is an integer ALTREP object.source§impl<T> Slices for Dataframe<T>
impl<T> Slices for Dataframe<T>
as_typed_slice_raw() etc.
source§unsafe fn as_typed_slice_raw<T>(&self) -> &[T]
unsafe fn as_typed_slice_raw<T>(&self) -> &[T]
Get an immutable slice to this object’s data. Read more
source§unsafe fn as_typed_slice_raw_mut<T>(&mut self) -> &mut [T]
unsafe fn as_typed_slice_raw_mut<T>(&mut self) -> &mut [T]
Get a mutable slice to this object’s data. Read more
impl<T> StructuralPartialEq for Dataframe<T>
Auto Trait Implementations§
impl<T> Freeze for Dataframe<T>
impl<T> RefUnwindSafe for Dataframe<T>where
T: RefUnwindSafe,
impl<T> !Send for Dataframe<T>
impl<T> !Sync for Dataframe<T>
impl<T> Unpin for Dataframe<T>where
T: Unpin,
impl<T> UnwindSafe for Dataframe<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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more