Skip to content

Commit

Permalink
features
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Oct 3, 2024
1 parent 217d72f commit e1ed3b7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions crates/polars-error/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,17 +397,16 @@ macro_rules! polars_ensure {
pub fn to_compute_err(err: impl Display) -> PolarsError {
PolarsError::ComputeError(err.to_string().into())
}

#[macro_export]
macro_rules! feature_gated {
($feature:expr, $content:expr) => {{
#[cfg(feature = $feature)]
($($feature:literal);*, $content:expr) => {{
#[cfg(all($(feature = $feature),*))]
{
$content
}
#[cfg(not(feature = $feature))]
#[cfg(not(all($(feature = $feature),*)))]
{
panic!("activate '{}' feature", $feature)
panic!("activate '{}' feature", concat!($($feature, ", "),*))
}
}};
}
Expand Down
2 changes: 1 addition & 1 deletion crates/polars-plan/src/dsl/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ impl OpaqueColumnUdf {
match self {
Self::Deserialized(t) => Ok(t),
Self::Bytes(b) => {
feature_gated!("serde", {
feature_gated!("serde";"python", {
python_udf::PythonUdfExpression::try_deserialize(b.as_ref()).map(SpecialEq::new)
})
},
Expand Down

0 comments on commit e1ed3b7

Please sign in to comment.