pub struct ExtDType { /* private fields */ }Expand description
A type descriptor for an extension type
Implementations§
Source§impl ExtDType
impl ExtDType
Sourcepub fn new(
id: ExtID,
storage_dtype: Arc<DType>,
metadata: Option<ExtMetadata>,
) -> Self
pub fn new( id: ExtID, storage_dtype: Arc<DType>, metadata: Option<ExtMetadata>, ) -> Self
Creates a new ExtDType.
Extension data types in Vortex allows library users to express additional semantic meaning on top of a set of scalar values. Metadata can optionally be provided for the extension type to allow for parameterized types.
A simple example would be if one wanted to create a vortex.temperature extension type. The
canonical encoding for such values would be f64, and the metadata can contain an optional
temperature unit, allowing downstream users to be sure they properly account for Celsius
and Fahrenheit conversions.
use std::sync::Arc;
use vortex_dtype::{DType, ExtDType, ExtID, ExtMetadata, Nullability, PType};
#[repr(u8)]
enum TemperatureUnit {
C = 0u8,
F = 1u8,
}
// Make a new extension type that encodes the unit for a set of nullable `f64`.
pub fn create_temperature_type(unit: TemperatureUnit) -> ExtDType {
ExtDType::new(
ExtID::new("vortex.temperature".into()),
Arc::new(DType::Primitive(PType::F64, Nullability::Nullable)),
Some(ExtMetadata::new([unit as u8].into()))
)
}Sourcepub fn storage_dtype(&self) -> &DType
pub fn storage_dtype(&self) -> &DType
Returns the ExtMetadata for this extension type, if it exists
Sourcepub fn with_nullability(&self, nullability: Nullability) -> Self
pub fn with_nullability(&self, nullability: Nullability) -> Self
Returns a new ExtDType with the given nullability
Sourcepub fn metadata(&self) -> Option<&ExtMetadata>
pub fn metadata(&self) -> Option<&ExtMetadata>
Returns the ExtMetadata for this extension type, if it exists
Trait Implementations§
Source§impl PartialOrd for ExtDType
impl PartialOrd for ExtDType
impl Eq for ExtDType
impl StructuralPartialEq for ExtDType
Auto Trait Implementations§
impl Freeze for ExtDType
impl RefUnwindSafe for ExtDType
impl Send for ExtDType
impl Sync for ExtDType
impl Unpin for ExtDType
impl UnwindSafe for ExtDType
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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>
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 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>
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