Skip to content

Conversation

itsthatguy
Copy link

@itsthatguy itsthatguy commented Sep 17, 2025

This feature was requested here: #40

I'm not sure how you would want to approach this. Open to feedback.

Summary of Changes

Runtime Custom Operator Registration

  • Added ability to register custom operations at runtime (didn't exist
    before)
  • Three new operator types: regular, lazy, and data operations
  • Custom operators can override built-in operators

New Public API Functions

// None of these existed before this PR
pub fn add_operation(name: &str, operator: OperatorFn, num_params:
NumParams) -> Result<(), Error>
pub fn add_lazy_operation(name: &str, operator: LazyOperatorFn, num_params:
NumParams) -> Result<(), Error>
pub fn add_data_operation(name: &str, operator: DataOperatorFn, num_params:
NumParams) -> Result<(), Error>
pub fn remove_operation(name: &str) -> Result<bool, Error>
pub fn clear_operations() -> Result<(), Error>

New Error Types

  • Added Error::RegistryError variant for custom operator registry failures

New Exports

  • Made Error type public (pub use error::Error)
  • Exported operator function types: OperatorFn, LazyOperatorFn,
    DataOperatorFn, NumParams

New Dependencies

  • Added once_cell = "1.19" dependency

Internal Architecture Changes

  • Added dynamic operator registry system with thread-safe concurrent access
  • Extended existing operator system to support runtime registration
  • Added CustomOperatorRegistry with RwLock<HashMap> for each operator type

What Remained Unchanged

  • Core apply() function - same signature and behavior
  • All existing built-in operators work exactly the same
  • No breaking changes to existing API
  • All existing functionality preserved

@itsthatguy itsthatguy closed this Sep 17, 2025
@itsthatguy itsthatguy reopened this Sep 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant