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
6939 views
1
use super::*;
2
3
impl From<AggExpr> for Expr {
4
fn from(agg: AggExpr) -> Self {
5
Expr::Agg(agg)
6
}
7
}
8
9
impl From<&str> for Expr {
10
fn from(s: &str) -> Self {
11
col(PlSmallStr::from_str(s))
12
}
13
}
14
15
macro_rules! from_literals {
16
($type:ty) => {
17
impl From<$type> for Expr {
18
fn from(val: $type) -> Self {
19
lit(val)
20
}
21
}
22
};
23
}
24
25
from_literals!(f32);
26
from_literals!(f64);
27
#[cfg(feature = "dtype-i8")]
28
from_literals!(i8);
29
#[cfg(feature = "dtype-i16")]
30
from_literals!(i16);
31
from_literals!(i32);
32
from_literals!(i64);
33
#[cfg(feature = "dtype-u8")]
34
from_literals!(u8);
35
#[cfg(feature = "dtype-u16")]
36
from_literals!(u16);
37
from_literals!(u32);
38
from_literals!(u64);
39
from_literals!(bool);
40
41