Skip to main content

NumpyDtype

Enum NumpyDtype 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future 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

Fields

§scale: u8
§

Decimal128

Fields

§scale: u8
§

Decimal256

Fields

§scale: u8
§

GeohashI8

Fields

§bits: u8
§

GeohashI16

Fields

§bits: u8
§

GeohashI32

Fields

§bits: u8
§

GeohashI64

Fields

§bits: u8
§

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).

Fields

§ndim: u8
§shape: [u32; 32]

Implementations§

Source§

impl NumpyDtype

Source

pub fn wire_type(&self) -> u8

QWP wire-type byte for the column slot this dtype produces.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> NumpyDtype

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for NumpyDtype

Source§

impl Debug for NumpyDtype

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for NumpyDtype

Source§

impl PartialEq for NumpyDtype

Source§

fn eq(&self, other: &NumpyDtype) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for NumpyDtype

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Key for T
where T: Clone,

Source§

fn align() -> usize

The alignment necessary for the key. Must return a power of two.
Source§

fn size(&self) -> usize

The size of the key in bytes.
Source§

unsafe fn init(&self, ptr: *mut u8)

Initialize the key in the given memory location. Read more
Source§

unsafe fn get<'a>(ptr: *const u8) -> &'a T

Get a reference to the key from the given memory location. Read more
Source§

unsafe fn drop_in_place(ptr: *mut u8)

Drop the key in place. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V