Path: blob/main/crates/polars-plan/src/dsl/function_expr/bitwise.rs
6940 views
use std::fmt;12use strum_macros::IntoStaticStr;34#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]5#[cfg_attr(feature = "dsl-schema", derive(schemars::JsonSchema))]6#[derive(Clone, Copy, PartialEq, Debug, Eq, Hash, IntoStaticStr)]7#[strum(serialize_all = "snake_case")]8pub enum BitwiseFunction {9CountOnes,10CountZeros,1112LeadingOnes,13LeadingZeros,1415TrailingOnes,16TrailingZeros,1718// Bitwise Aggregations19And,20Or,21Xor,22}2324impl fmt::Display for BitwiseFunction {25fn fmt(&self, f: &mut fmt::Formatter<'_>) -> std::fmt::Result {26use BitwiseFunction as B;2728let s = match self {29B::CountOnes => "count_ones",30B::CountZeros => "count_zeros",31B::LeadingOnes => "leading_ones",32B::LeadingZeros => "leading_zeros",33B::TrailingOnes => "trailing_ones",34B::TrailingZeros => "trailing_zeros",3536B::And => "and",37B::Or => "or",38B::Xor => "xor",39};4041f.write_str(s)42}43}444546