Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pola-rs
GitHub Repository: pola-rs/polars
Path: blob/main/crates/polars-plan/src/dsl/from.rs
8327 views
1
use super::*;
2
use crate::dsl::functions::*;
3
4
impl From<AggExpr> for Expr {
5
fn from(agg: AggExpr) -> Self {
6
Expr::Agg(agg)
7
}
8
}
9
10
impl From<&str> for Expr {
11
fn from(s: &str) -> Self {
12
col(PlSmallStr::from_str(s))
13
}
14
}
15
16
macro_rules! from_literals {
17
($type:ty) => {
18
impl From<$type> for Expr {
19
fn from(val: $type) -> Self {
20
lit(val)
21
}
22
}
23
};
24
}
25
26
from_literals!(f32);
27
from_literals!(f64);
28
#[cfg(feature = "dtype-i8")]
29
from_literals!(i8);
30
#[cfg(feature = "dtype-i16")]
31
from_literals!(i16);
32
from_literals!(i32);
33
from_literals!(i64);
34
#[cfg(feature = "dtype-u8")]
35
from_literals!(u8);
36
#[cfg(feature = "dtype-u16")]
37
from_literals!(u16);
38
from_literals!(u32);
39
from_literals!(u64);
40
from_literals!(bool);
41
42