pub enum DataFrameShape {
Bare(BuiltDataFrame),
Split {
results: SplitResults,
error: BuiltDataFrame,
},
PerVariantList(Vec<(String, BuiltDataFrame)>),
}Expand description
Categorical return shape of the data.frame split verbs:
IntoDataFrameSplit::into_dataframe_split
and the serde helpers vec_to_dataframe_split / result_to_dataframe
(feature = "serde").
Carries enough type information that downstream Rust code can match
on the variant without dispatching on SEXP type. Convert to a SEXP via
the IntoR impl (or just return it from a #[miniextendr]
fn), which collapses every variant to the equivalent R value (bare
data.frame / named list of data.frames / list(results=, error=)).
§GC discipline (rooted by construction, #1265, #1750)
Every frame inside the shape is an owned, GC-rooted
BuiltDataFrame, and the
SplitResults::None sentinel carries its own Preserved
root — so holding a DataFrameShape across R allocations is safe by
construction; there is no convert-immediately contract. The
IntoR conversion consumes the handles, re-rooting each
child in the assembled R value.
Variants§
Bare(BuiltDataFrame)
Single data.frame.
Used by:
into_dataframe_spliton a single-variant enum, always.- serde
vec_to_dataframe_splitwhen only one variant is present (andSplitShape::PerVariantListorSplitShape::PerVariantListWithTagis selected — the single-variant short-circuit) or always underSplitShape::Collated. - serde
result_to_dataframeunderResultShape::Autowhen every row isOk, and always underResultShape::Collated.
Split
list(results = <df | sentinel>, error = df).
Produced only by serde result_to_dataframe: under
ResultShape::Auto when at least one Err is present, and always
under ResultShape::Split. The split verbs never produce it.
Fields
results: SplitResultsThe Ok partition.
error: BuiltDataFrameThe error partition (always present, possibly zero-row).
PerVariantList(Vec<(String, BuiltDataFrame)>)
list(VariantA = df, VariantB = df, …).
Produced by:
into_dataframe_spliton a multi-variant enum, always: one entry per declared variant, in declaration order, keyed by the snake_case variant name. A variant absent from the input is a 0-row frame with that variant’s columns.- serde
vec_to_dataframe_splitunderSplitShape::PerVariantList/SplitShape::PerVariantListWithTagwhen the input contains more than one variant. Order matches first-seen order in the input slice.
Trait Implementations§
Source§impl IntoR for DataFrameShape
impl IntoR for DataFrameShape
Source§fn try_into_sexp(self) -> Result<SEXP, Self::Error>
fn try_into_sexp(self) -> Result<SEXP, Self::Error>
Source§unsafe fn try_into_sexp_unchecked(self) -> Result<SEXP, Self::Error>
unsafe fn try_into_sexp_unchecked(self) -> Result<SEXP, Self::Error>
Auto Trait Implementations§
impl !Send for DataFrameShape
impl !Sync for DataFrameShape
impl Freeze for DataFrameShape
impl RefUnwindSafe for DataFrameShape
impl Unpin for DataFrameShape
impl UnsafeUnpin for DataFrameShape
impl UnwindSafe for DataFrameShape
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
Source§impl<T> SizeHint for Twhere
T: ?Sized,
impl<T> SizeHint for Twhere
T: ?Sized,
Source§default fn lower_bound(&self) -> usize
default fn lower_bound(&self) -> usize
core_io_internals)[u8; 12] could return any value between 0 and
12 inclusively as a correct implementation. Read moreSource§impl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)]const SIZE: usize = _
#[doc(hidden)]const SIZE: usize = _
sized_type_properties)Source§#[doc(hidden)]const ALIGN: usize = _
#[doc(hidden)]const ALIGN: usize = _
sized_type_properties)Source§#[doc(hidden)]const ALIGNMENT: Alignment = _
#[doc(hidden)]const ALIGNMENT: Alignment = _
ptr_alignment_type)Source§#[doc(hidden)]const IS_ZST: bool = _
#[doc(hidden)]const IS_ZST: bool = _
sized_type_properties)Source§#[doc(hidden)]const LAYOUT: Layout = _
#[doc(hidden)]const LAYOUT: Layout = _
sized_type_properties)Source§#[doc(hidden)]const MAX_SLICE_LEN: usize = _
#[doc(hidden)]const MAX_SLICE_LEN: usize = _
sized_type_properties)[Self]. Read moreLayout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 40 bytes
Size for each variant:
Bare: 24 bytesSplit: 40 bytesPerVariantList: 32 bytes