polars_expr/
lib.rs

1#![cfg_attr(
2    feature = "allow_unused",
3    allow(unused, dead_code, irrefutable_let_patterns)
4)] // Maybe be caused by some feature
5pub mod dispatch;
6mod expressions;
7pub mod groups;
8pub mod hash_keys;
9pub mod hot_groups;
10pub mod idx_table;
11pub mod planner;
12pub mod prelude;
13pub mod reduce;
14pub mod state;
15
16use polars_utils::IdxSize;
17
18pub use crate::planner::{ExpressionConversionState, create_physical_expr};
19
20/// An index where the top bit indicates whether a value should be evicted.
21pub struct EvictIdx(IdxSize);
22
23impl EvictIdx {
24    #[inline(always)]
25    pub fn new(idx: IdxSize, should_evict: bool) -> Self {
26        debug_assert!(idx >> (IdxSize::BITS - 1) == 0);
27        Self(idx | ((should_evict as IdxSize) << (IdxSize::BITS - 1)))
28    }
29
30    #[inline(always)]
31    pub fn idx(&self) -> usize {
32        (self.0 & ((1 << (IdxSize::BITS - 1)) - 1)) as usize
33    }
34
35    #[inline(always)]
36    pub fn should_evict(&self) -> bool {
37        (self.0 >> (IdxSize::BITS - 1)) != 0
38    }
39}