clarkmcc / cel-rust

Common Expression Language interpreter written in Rust
https://crates.io/crates/cel-interpreter
MIT License
377 stars 21 forks source link

Add `Context::new` #90

Closed Caellian closed 3 weeks ago

Caellian commented 3 weeks ago

Currently Context must be default constructed but there's situations where one might want to disable regex or chrono dependencies, or switch them up with alternative implementations (e.g. oniguruma).

I agree having those methods is a good default (though I'd feature gate them to allow reducing dependencies), but adding a Context::new can't hurt and something like:

Prefer using Default as it contains functions required for casting and good defaults, or at least copy the casting function from Default.

in Context::new documentation should be enough to point users in the right direction.

Or maybe include casting functions in Context::new and add Context::empty as well with a warning in the documentation.

clarkmcc commented 3 weeks ago

@Caellian will you please review #97 and provide any feedback