File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -390,6 +390,27 @@ impl DType {
390390 }
391391 }
392392
393+ /// Returns the [`StructFields`] from a struct [`DType`].
394+ ///
395+ /// # Panics
396+ ///
397+ /// If the [`DType`] is not a struct.
398+ pub fn into_struct_fields ( self ) -> StructFields {
399+ if let Struct ( f, _) = self {
400+ return f;
401+ }
402+ vortex_panic ! ( "DType is not a Struct" )
403+ }
404+
405+ /// Get the `StructDType` if `self` is a `StructDType`, otherwise `None`
406+ pub fn into_struct_fields_opt ( self ) -> StructFields {
407+ if let Struct ( f, _) = self {
408+ Some ( f)
409+ } else {
410+ None
411+ }
412+ }
413+
393414 /// Convenience method for creating a [`DType::List`].
394415 pub fn list ( dtype : impl Into < DType > , nullability : Nullability ) -> Self {
395416 List ( Arc :: new ( dtype. into ( ) ) , nullability)
You can’t perform that action at this time.
0 commit comments