pub enum Data {
Bool(Buf<u8>),
I64(Buf<i64>),
Ext(Buf<Ext>),
Rat(Buf<Rat>),
F64(Buf<f64>),
Complex(Buf<Cx>),
Char(Buf<char>),
Symbol(Buf<Id>),
Box(Buf<Array>),
}Variants§
Bool(Buf<u8>)
I64(Buf<i64>)
Ext(Buf<Ext>)
Arbitrary-precision integers. Like boxes, these are heap-backed pointers rather than machine words: never foreign, never fused, never vectorised.
Rat(Buf<Rat>)
Exact ratios, each in lowest terms. Heap-backed, as Ext is.
F64(Buf<f64>)
Complex(Buf<Cx>)
Complex numbers, interleaved [re, im] — the layout numpy, C and a
pair of Arrow float columns all share.
Char(Buf<char>)
Symbol(Buf<Id>)
Symbols: every element is an index into the process-wide symbol
table (see crate::symbol), so the buffer is as flat and as
cheap to copy as one of integers and the names live once each.
Box(Buf<Array>)
Boxes: every element is a whole array. Foreign memory never holds these, so a boxed buffer is always owned and cloning it is a refcount bump like any other.
Implementations§
Source§impl Data
impl Data
pub fn dtype(&self) -> DType
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn is_foreign(&self) -> bool
pub fn is_foreign(&self) -> bool
True while the payload still borrows foreign memory.
Sourcepub fn owner(&self) -> Option<&Owner>
pub fn owner(&self) -> Option<&Owner>
The handle keeping this payload’s memory alive, for a borrowed one.
See Buf::owner.
pub fn slice(&self, start: usize, end: usize) -> Data
pub fn empty(dtype: DType) -> Data
Sourcepub fn push_fill(&mut self)
pub fn push_fill(&mut self)
The fill element used by overtaking and framing. The boxed fill is
J’s a:, a box holding an empty numeric list.
Sourcepub fn push_from(&mut self, src: &Data, i: usize)
pub fn push_from(&mut self, src: &Data, i: usize)
Append element i of src, which must hold the same type. Nothing
happens if the types disagree; every caller has checked already.
pub fn extend_from(&mut self, other: &Data) -> bool
Sourcepub fn join(columns: &[Data], rows: usize) -> Option<Data>
pub fn join(columns: &[Data], rows: usize) -> Option<Data>
The columns end to end, as the flat buffer of a Layout::ColMajor
array of shape [rows, columns.len()].
Nothing is copied: each column keeps borrowing whatever memory it arrived in, and the buffer joins them only if some reader asks for the flat slice. This is the table boundary that does no work.
None on the same disagreements Data::interleave refuses.
Sourcepub fn columns(&self, rows: usize, cols: usize) -> Vec<Data>
pub fn columns(&self, rows: usize, cols: usize) -> Vec<Data>
The cols runs of rows elements this buffer holds, each as a
buffer of its own: the columns of a Layout::ColMajor array.
Slicing a joined buffer at a seam copies nothing, so a table that
arrived as columns is read back as the columns it arrived as.
Sourcepub fn interleave(columns: &[Data], rows: usize) -> Option<Data>
pub fn interleave(columns: &[Data], rows: usize) -> Option<Data>
Weave column-major buffers into one row-major block of shape
[rows, columns.len()].
This is the table boundary: a DataFrame arrives as one buffer per column and libjay works rows-leading, so the elements have to be woven once. The weave reads every column in order and writes its result straight through, split across threads at the sizes that pay.
None when the columns disagree on element type, when one is shorter
than rows, or when there are no columns at all — the importing
side has already reported that.
Trait Implementations§
impl StructuralPartialEq for Data
Auto Trait Implementations§
impl !RefUnwindSafe for Data
impl !UnwindSafe for Data
impl Freeze for Data
impl Send for Data
impl Sync for Data
impl Unpin for Data
impl UnsafeUnpin for Data
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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> ⓘ
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