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