I cannot compile this code, before submitting an issue I'd like your help to understand if I'm doing it wrong
My main.rs
use polars::prelude::*;
fn main() {
let expr = int_range(0,10,1,DataType::UInt64);
println!("{:?}", expr);
}
my cargo.toml
[package]
name = "test0"
version = "0.1.0"
edition = "2021"
[dependencies]
polars = { version = "0.44.0", features = ["lazy"] }
according to the docs https://docs.rs/polars/latest/polars/prelude/fn.int_range.html this should compile but I got this error
error[E0425]: cannot find function `int_range` in this scope
--> src/main.rs:4:16
|
4 | let expr = int_range(0,10,1,DataType::UInt64);
| ^^^^^^^^^ help: a function with a similar name exists: `date_range`
The function also requires the range
feature which is unfortunately not documented.
You can find out by digging through the sources of polars_plan
where int_range
is defined it contains:
#[cfg(feature = "range")] mod range;
where range
is the module you reach by clicking the Source link on the documentation page you linked
so you'll need to enable range
as well:
cargo add polars -F range
or edit your Cargo.toml
to include it:
polars = { version = "0.44.0", features = ["lazy", "range"] }
You'll also have to make the first two arguments Expr
s which integer literals are not:
let expr = int_range(lit(0), lit(10), 1, DataType::UInt64);
Since the docs are auto generated this will not be fixed anytime soon see #19496