polars_plan/dsl/
from.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use super::*;

impl From<AggExpr> for Expr {
    fn from(agg: AggExpr) -> Self {
        Expr::Agg(agg)
    }
}

impl From<&str> for Expr {
    fn from(s: &str) -> Self {
        col(PlSmallStr::from_str(s))
    }
}

macro_rules! from_literals {
    ($type:ty) => {
        impl From<$type> for Expr {
            fn from(val: $type) -> Self {
                lit(val)
            }
        }
    };
}

from_literals!(f32);
from_literals!(f64);
#[cfg(feature = "dtype-i8")]
from_literals!(i8);
#[cfg(feature = "dtype-i16")]
from_literals!(i16);
from_literals!(i32);
from_literals!(i64);
#[cfg(feature = "dtype-u8")]
from_literals!(u8);
#[cfg(feature = "dtype-u16")]
from_literals!(u16);
from_literals!(u32);
from_literals!(u64);
from_literals!(bool);