Starting to add a dtype type for implementing enum

This commit is contained in:
Jack Wright 2025-04-04 10:43:09 -07:00
parent dbce0068b0
commit f61d5f9882
2 changed files with 20 additions and 0 deletions

View File

@ -6,6 +6,7 @@ mod nu_lazygroupby;
mod nu_schema; mod nu_schema;
mod nu_when; mod nu_when;
pub mod utils; pub mod utils;
mod nu_dtype;
use crate::{Cacheable, PolarsPlugin}; use crate::{Cacheable, PolarsPlugin};
use nu_plugin::EngineInterface; use nu_plugin::EngineInterface;
@ -21,6 +22,7 @@ pub use nu_expression::{NuExpression, NuExpressionCustomValue};
pub use nu_lazyframe::{NuLazyFrame, NuLazyFrameCustomValue}; pub use nu_lazyframe::{NuLazyFrame, NuLazyFrameCustomValue};
pub use nu_lazygroupby::{NuLazyGroupBy, NuLazyGroupByCustomValue}; pub use nu_lazygroupby::{NuLazyGroupBy, NuLazyGroupByCustomValue};
pub use nu_schema::{str_to_dtype, NuSchema}; pub use nu_schema::{str_to_dtype, NuSchema};
pub use nu_dtype::NuDataType;
pub use nu_when::{NuWhen, NuWhenCustomValue, NuWhenType}; pub use nu_when::{NuWhen, NuWhenCustomValue, NuWhenType};
#[derive(Debug, Clone)] #[derive(Debug, Clone)]

View File

@ -0,0 +1,18 @@
use nu_protocol::{ShellError, Span};
use polars::prelude::{DataType, UnknownKind};
#[derive(Debug, Clone)]
pub struct NuDataType {
dtype: DataType,
}
impl NuDataType {
pub fn new(dtype: DataType) -> Self {
Self { dtype }
}
pub fn to_polars(&self) -> DataType {
self.dtype.clone()
}
}