Enum DataType

Source
#[non_exhaustive]
pub enum DataType {
Show 49 variants Bool, Int2, Int4, Int8, Int16, Int32, Int64, UInt2, UInt4, UInt8, UInt16, UInt32, UInt64, Float4E2M1FN, Float6E2M3FN, Float6E3M2FN, Float8E3M4, Float8E4M3, Float8E4M3B11FNUZ, Float8E4M3FNUZ, Float8E5M2, Float8E5M2FNUZ, Float8E8M0FNU, BFloat16, Float16, Float32, Float64, ComplexBFloat16, ComplexFloat16, ComplexFloat32, ComplexFloat64, ComplexFloat4E2M1FN, ComplexFloat6E2M3FN, ComplexFloat6E3M2FN, ComplexFloat8E3M4, ComplexFloat8E4M3, ComplexFloat8E4M3B11FNUZ, ComplexFloat8E4M3FNUZ, ComplexFloat8E5M2, ComplexFloat8E5M2FNUZ, ComplexFloat8E8M0FNU, Complex64, Complex128, RawBits(usize), String, Bytes, NumpyDateTime64 { unit: NumpyTimeUnit, scale_factor: NonZeroU32, }, NumpyTimeDelta64 { unit: NumpyTimeUnit, scale_factor: NonZeroU32, }, Extension(Arc<dyn DataTypeExtension>),
}
Expand description

A data type.

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

Bool

bool Boolean.

§

Int2

int2 Integer in [-2, 1].

§

Int4

int4 Integer in [-8, 7].

§

Int8

int8 Integer in [-2^7, 2^7-1].

§

Int16

int16 Integer in [-2^15, 2^15-1].

§

Int32

int32 Integer in [-2^31, 2^31-1].

§

Int64

int64 Integer in [-2^63, 2^63-1].

§

UInt2

uint2 Integer in [0, 3].

§

UInt4

uint4 Integer in [0, 15].

§

UInt8

uint8 Integer in [0, 2^8-1].

§

UInt16

uint16 Integer in [0, 2^16-1].

§

UInt32

uint32 Integer in [0, 2^32-1].

§

UInt64

uint64 Integer in [0, 2^64-1].

§

Float4E2M1FN

float4_e2m1fn a 4-bit floating point representation: sign bit, 2 bit exponent (bias 1), 1 bit mantissa.

  • Extended range: no infinity, no NaN.
  • Subnormal numbers when biased exponent is 0.
§

Float6E2M3FN

float6_e2m3fn a 6-bit floating point representation: sign bit, 2 bit exponent (bias 1), 3 bit mantissa.

  • Extended range: no infinity, no NaN.
  • Subnormal numbers when biased exponent is 0.
§

Float6E3M2FN

float6_e3m2fn a 6-bit floating point representation: sign bit, 3 bit exponent (bias 3), 2 bit mantissa.

  • Extended range: no infinity, no NaN.
  • Subnormal numbers when biased exponent is 0.
§

Float8E3M4

float8_e3m4 an 8-bit floating point representation: sign bit, 3 bit exponent (bias 3), 4 bit mantissa.

  • IEEE 754-compliant, with NaN and +/-inf.
§

Float8E4M3

float8_e4m3 an 8-bit floating point representation: sign bit, 4 bit exponent (bias 7), 3 bit mantissa.

  • IEEE 754-compliant, with NaN and +/-inf.
§

Float8E4M3B11FNUZ

float8_e4m3b11fnuz an 8-bit floating point representation: sign bit, 4 bit exponent (bias 11), 3 bit mantissa.

  • Extended range: no infinity, NaN represented by 0b1000'0000.
  • Subnormal numbers when biased exponent is 0.
§

Float8E4M3FNUZ

float8_e4m3fnuz an 8-bit floating point representation: sign bit, 4 bit exponent (bias 8), 3 bit mantissa.

  • Extended range: no infinity, NaN represented by 0b1000'0000.
  • Subnormal numbers when biased exponent is 0.
§

Float8E5M2

float8_e5m2 an 8-bit floating point representation: sign bit, 5 bit exponent (bias 15), 2 bit mantissa.

  • IEEE 754-compliant, with NaN and +/-inf.
  • Subnormal numbers when biased exponent is 0.
§

Float8E5M2FNUZ

float8_e5m2fnuz an 8-bit floating point representation: sign bit, 5 bit exponent (bias 16), 2 bit mantissa.

  • Extended range: no infinity, NaN represented by 0b1000'0000.
  • Subnormal numbers when biased exponent is 0.
§

Float8E8M0FNU

float8_e8m0fnu an 8-bit floating point representation: no sign bit, 8 bit exponent (bias 127), 0 bit mantissa.

  • No zero, no infinity, NaN represented by 0b1111'1111.
  • No subnormal numbers.
§

BFloat16

bfloat16 brain floating point data type: sign bit, 5 bits exponent, 10 bits mantissa.

§

Float16

float16 IEEE 754 half-precision floating point: sign bit, 5 bits exponent, 10 bits mantissa.

§

Float32

float32 IEEE 754 single-precision floating point: sign bit, 8 bits exponent, 23 bits mantissa.

§

Float64

float64 IEEE 754 double-precision floating point: sign bit, 11 bits exponent, 52 bits mantissa.

§

ComplexBFloat16

complex_float32 real and complex components are each brain floating point data type.

§

ComplexFloat16

complex_float32 real and complex components are each IEEE 754 half-precision floating point.

§

ComplexFloat32

complex_float32 real and complex components are each IEEE 754 single-precision floating point.

§

ComplexFloat64

complex_float64 real and complex components are each IEEE 754 double-precision floating point.

§

ComplexFloat4E2M1FN

complex_float4_e2m1fn real and complex components are each the float4_e2m1fn type.

§

ComplexFloat6E2M3FN

complex_float6_e2m3fn real and complex components are each the float6_e2m3fn type.

§

ComplexFloat6E3M2FN

complex_float6_e3m2fn real and complex components are each the float6_e3m2fn type.

§

ComplexFloat8E3M4

complex_float8_e3m4 real and complex components are each the float8_e3m4 type.

§

ComplexFloat8E4M3

complex_float8_e4m3 real and complex components are each the float8_e4m3 type.

§

ComplexFloat8E4M3B11FNUZ

complex_float8_e4m3b11fnuz real and complex components are each the float8_e4m3b11fnuz type.

§

ComplexFloat8E4M3FNUZ

complex_float8_e4m3fnuz real and complex components are each the float8_e4m3fnuz type.

§

ComplexFloat8E5M2

complex_float8_e5m2 real and complex components are each the float8_e5m2 type.

§

ComplexFloat8E5M2FNUZ

complex_float8_e5m2fnuz real and complex components are each the float8_e5m2fnuz type.

§

ComplexFloat8E8M0FNU

complex_float8_e8m0fnu real and complex components are each the float8_e8m0fnu type.

§

Complex64

complex64 real and complex components are each IEEE 754 single-precision floating point.

§

Complex128

complex128 real and complex components are each IEEE 754 double-precision floating point.

§

RawBits(usize)

r* raw bits, variable size given by *, limited to be a multiple of 8.

§

String

A UTF-8 encoded string.

§

Bytes

Variable-sized binary data.

§

NumpyDateTime64

numpy.datetime64 a 64-bit signed integer represents moments in time relative to the Unix epoch.

This data type closely models the datetime64 data type from NumPy.

Fields

§unit: NumpyTimeUnit

The NumPy temporal unit.

§scale_factor: NonZeroU32

The NumPy temporal scale factor.

§

NumpyTimeDelta64

numpy.timedelta64 a 64-bit signed integer represents signed temporal durations.

This data type closely models the timedelta64 data type from NumPy.

Fields

§unit: NumpyTimeUnit

The NumPy temporal unit.

§scale_factor: NonZeroU32

The NumPy temporal scale factor.

§

Extension(Arc<dyn DataTypeExtension>)

An extension data type.

Implementations§

Source§

impl DataType

Source

pub fn name(&self) -> String

Returns the name.

Source

pub fn metadata(&self) -> MetadataV3

Returns the metadata.

Source

pub fn size(&self) -> DataTypeSize

Returns the DataTypeSize.

Source

pub fn fixed_size(&self) -> Option<usize>

Returns the size in bytes of a fixed-size data type, otherwise returns None.

Source

pub fn from_metadata( metadata: &MetadataV3, data_type_aliases: &ExtensionAliasesDataTypeV3, ) -> Result<Self, PluginCreateError>

Create a data type from metadata.

§Errors

Returns PluginCreateError if the metadata is invalid or not associated with a registered data type plugin.

Source

pub fn fill_value_from_metadata( &self, fill_value: &FillValueMetadataV3, ) -> Result<FillValue, DataTypeFillValueMetadataError>

Create a fill value from metadata.

§Errors

Returns DataTypeFillValueMetadataError if the fill value is incompatible with the data type.

Source

pub fn metadata_fill_value( &self, fill_value: &FillValue, ) -> Result<FillValueMetadataV3, DataTypeFillValueError>

Create fill value metadata.

§Errors

Returns an DataTypeFillValueError if the metadata cannot be created from the fill value.

Trait Implementations§

Source§

impl Clone for DataType

Source§

fn clone(&self) -> DataType

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for DataType

Source§

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

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

impl Display for DataType

Source§

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

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

impl PartialEq for DataType

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for DataType

Auto Trait Implementations§

Blanket Implementations§

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<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<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<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> 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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.