mirror of
https://github.com/nushell/nushell.git
synced 2025-06-09 19:46:56 +02:00
Starting to add a dtype type for implementing enum
This commit is contained in:
parent
dbce0068b0
commit
f61d5f9882
@ -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)]
|
||||||
|
18
crates/nu_plugin_polars/src/dataframe/values/nu_dtype.rs
Normal file
18
crates/nu_plugin_polars/src/dataframe/values/nu_dtype.rs
Normal 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()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user