pub struct ExtensionTypeRegistration { /* private fields */ }Expand description
The registration of an extension type. Implementations of this trait are responsible for
creating instances of DFExtensionType that represent the entire semantics of an extension
type.
§Why do we need a Registration?
A good question is why this trait is even necessary. Why not directly register the
DFExtensionType in a registry?
While this works for extension types requiring no additional metadata (e.g., arrow.uuid), it
does not work for more complex extension types with metadata. For example, consider an extension
type custom.shortened(n) that aims to short the pretty-printing string to n characters.
Here, n is a parameter of the extension type and should be a field in the struct that
implements the DFExtensionType. The job of the registration is to read the metadata from the
field and create the corresponding DFExtensionType instance with the correct n set.
Implementations§
Source§impl ExtensionTypeRegistration
impl ExtensionTypeRegistration
Sourcepub fn new_arc(
name: impl Into<String>,
factory: impl Fn(&DataType, Option<&str>) -> Result<DFExtensionTypeRef> + Send + Sync + 'static,
) -> ExtensionTypeRegistrationRef
pub fn new_arc( name: impl Into<String>, factory: impl Fn(&DataType, Option<&str>) -> Result<DFExtensionTypeRef> + Send + Sync + 'static, ) -> ExtensionTypeRegistrationRef
Creates a new registration for an extension type. The factory is required to validate that
the storage DataType is compatible with the extension type.
Source§impl ExtensionTypeRegistration
impl ExtensionTypeRegistration
Sourcepub fn type_name(&self) -> &str
pub fn type_name(&self) -> &str
The name of the extension type.
This name will be used to find the correct ExtensionTypeRegistration when an extension type is encountered.
Sourcepub fn create_df_extension_type(
&self,
storage_type: &DataType,
metadata: Option<&str>,
) -> Result<DFExtensionTypeRef>
pub fn create_df_extension_type( &self, storage_type: &DataType, metadata: Option<&str>, ) -> Result<DFExtensionTypeRef>
Creates an extension type instance from the optional metadata. The name of the extension type is not a parameter as it’s already defined by the registration itself.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ExtensionTypeRegistration
impl !UnwindSafe for ExtensionTypeRegistration
impl Freeze for ExtensionTypeRegistration
impl Send for ExtensionTypeRegistration
impl Sync for ExtensionTypeRegistration
impl Unpin for ExtensionTypeRegistration
impl UnsafeUnpin for ExtensionTypeRegistration
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
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