#[non_exhaustive]pub enum NumpyDtype {
Show 38 variants
I64Direct,
F64Direct,
DateI64Direct,
TimestampMicrosDirect,
TimestampNanosDirect,
LongDirect,
UuidDirect,
Long256Direct,
Ipv4Direct,
CharDirect,
I8Direct,
I16Direct,
I32Direct,
I8WidenToI32,
I16WidenToI32,
I32WidenToI64,
U8WidenToI32,
U16WidenToI32,
U32WidenToI64,
U64WidenToI64,
F32Direct,
F16Widen,
Bool,
DatetimeSecToMicros,
DatetimeMinuteToMicros,
DatetimeHourToMicros,
DatetimeDayToMicros,
DatetimeWeekToMicros,
DatetimeMonthToMicros,
DatetimeYearToMicros,
Decimal64 {
scale: u8,
},
Decimal128 {
scale: u8,
},
Decimal256 {
scale: u8,
},
GeohashI8 {
bits: u8,
},
GeohashI16 {
bits: u8,
},
GeohashI32 {
bits: u8,
},
GeohashI64 {
bits: u8,
},
F64Ndarray {
ndim: u8,
shape: [u32; 32],
},
}Expand description
Numpy source-dtype tag. The chunk’s NumpyDeferred variant stores
one; the encoder walks it at flush.
Scale (decimal) and bit-width (geohash) values must be validated by the caller (push_numpy_deferred / the FFI dispatcher) before being embedded — emit code trusts them and does not re-check ranges.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
I64Direct
F64Direct
DateI64Direct
TimestampMicrosDirect
TimestampNanosDirect
LongDirect
UuidDirect
Long256Direct
Ipv4Direct
CharDirect
I8Direct
I16Direct
I32Direct
I8WidenToI32
I16WidenToI32
I32WidenToI64
U8WidenToI32
U16WidenToI32
U32WidenToI64
U64WidenToI64
F32Direct
F16Widen
Bool
DatetimeSecToMicros
DatetimeMinuteToMicros
DatetimeHourToMicros
DatetimeDayToMicros
DatetimeWeekToMicros
DatetimeMonthToMicros
DatetimeYearToMicros
Decimal64
Decimal128
Decimal256
GeohashI8
GeohashI16
GeohashI32
GeohashI64
F64Ndarray
f64 ndarray: rectangular tensor of shape (row_count, dim[0], dim[1], …).
ndim is 1..=MAX_ARRAY_DIMS; only the first ndim entries of
shape are meaningful — trailing entries are zero. All rows share
this shape (numpy ndarrays are rectangular).
Implementations§
Source§impl NumpyDtype
impl NumpyDtype
Sourcepub fn bytes_per_row(&self) -> usize
pub fn bytes_per_row(&self) -> usize
Per-row wire payload size for the upfront frame-size estimate.
Bool is bit-packed so the true cost is row_count.div_ceil(8);
reporting 1 here keeps the estimate as a (correct) over-bound.
The leading scale / bits byte for decimal / geohash is a fixed
+1 per column and is rolled into the column’s null-overhead
allowance by the caller.
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Reject dtype configurations that the encoder cannot safely
allocate for. Currently bounds F64Ndarray’s shape to
1..=MAX_ARRAY_DIMS dimensions, non-zero per-dimension extents,
and prod(shape) <= MAX_NDARRAY_LEAF_ELEMS to keep the per-row
reservation well under isize::MAX. All other variants are
inherently bounded by their wire-type encoding.
Sourcepub fn source_elem_size(&self) -> Result<usize>
pub fn source_elem_size(&self) -> Result<usize>
Source-buffer stride in bytes per row — how many bytes the
flush-time encoder (emit_into_wire) reads per row from the
caller’s data pointer. This is the source element width, which
is decoupled from the wire width (e.g. U8WidenToI32 reads 1
source byte but emits 4): the bounds check must use the read
stride, never the wire stride.
Callers use this to validate a caller-supplied buffer byte length
against row_count before parking the raw pointer for deferred,
zero-copy encode — without it a mis-tagged dtype or an inflated
row_count would walk the pointer past the real allocation at
flush time (host-memory info-leak onto the wire, or a segfault).
For NumpyDtype::F64Ndarray each row is a full tensor, so the
stride is prod(shape[..ndim]) * size_of::<f64>(). The shape is
already range-bounded by Self::validate (prod <= MAX_NDARRAY_LEAF_ELEMS, ndim <= MAX_ARRAY_DIMS), so the multiply
cannot overflow once validated; the checked_mul is defensive in
case this is ever called on an unvalidated value.
Trait Implementations§
Source§impl Clone for NumpyDtype
impl Clone for NumpyDtype
Source§fn clone(&self) -> NumpyDtype
fn clone(&self) -> NumpyDtype
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for NumpyDtype
Source§impl Debug for NumpyDtype
impl Debug for NumpyDtype
impl Eq for NumpyDtype
Source§impl PartialEq for NumpyDtype
impl PartialEq for NumpyDtype
impl StructuralPartialEq for NumpyDtype
Auto Trait Implementations§
impl Freeze for NumpyDtype
impl RefUnwindSafe for NumpyDtype
impl Send for NumpyDtype
impl Sync for NumpyDtype
impl Unpin for NumpyDtype
impl UnsafeUnpin for NumpyDtype
impl UnwindSafe for NumpyDtype
Blanket Implementations§
impl<T> Allocation for T
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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