Path: blob/main/crates/polars-plan/src/dsl/function_expr/struct_.rs
6940 views
use super::*;12#[derive(Clone, Eq, PartialEq, Hash, Debug)]3#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]4#[cfg_attr(feature = "dsl-schema", derive(schemars::JsonSchema))]5pub enum StructFunction {6FieldByName(PlSmallStr),7RenameFields(Arc<[PlSmallStr]>),8PrefixFields(PlSmallStr),9SuffixFields(PlSmallStr),10#[cfg(feature = "json")]11JsonEncode,12WithFields,13SelectFields(Selector),14#[cfg(feature = "python")]15MapFieldNames(SpecialEq<Arc<polars_utils::python_function::PythonObject>>),16}1718impl Display for StructFunction {19fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {20use StructFunction::*;21match self {22FieldByName(name) => write!(f, "struct.field_by_name({name})"),23RenameFields(names) => write!(f, "struct.rename_fields({names:?})"),24PrefixFields(_) => write!(f, "name.prefix_fields"),25SuffixFields(_) => write!(f, "name.suffixFields"),26#[cfg(feature = "json")]27JsonEncode => write!(f, "struct.to_json"),28WithFields => write!(f, "struct.with_fields"),29SelectFields(_) => write!(f, "struct.field"),30#[cfg(feature = "python")]31MapFieldNames(_) => write!(f, "map_field_names"),32}33}34}353637