pub struct TransformRegistry { /* private fields */ }Expand description
A registry of named async transform functions keyed by name.
Both sync and async callables can be registered:
register— wraps a syncFnin an async block.register_async— stores a native async fn directly.
A shared rhai::Engine is embedded for evaluating EdgeTransform::Script
variants. The engine has conservative safety limits applied by default
(max_operations = 50_000, max_call_levels = 32).
Implementations§
Source§impl TransformRegistry
impl TransformRegistry
Sourcepub fn new() -> Self
pub fn new() -> Self
Create an empty registry with a sandboxed Rhai scripting engine.
The engine has the following safety limits:
- Maximum 50,000 operations per script evaluation.
- Maximum 32 nested function call levels.
Sourcepub fn register(
&mut self,
name: impl Into<String>,
f: impl Fn(Vec<Value>) -> Value + Send + Sync + 'static,
)
pub fn register( &mut self, name: impl Into<String>, f: impl Fn(Vec<Value>) -> Value + Send + Sync + 'static, )
Register a synchronous transform function.
The function is wrapped in an async block so it integrates seamlessly with the rest of the async execution path.
Sourcepub fn register_async<F, Fut>(&mut self, name: impl Into<String>, f: F)
pub fn register_async<F, Fut>(&mut self, name: impl Into<String>, f: F)
Register a native async transform function.
Use this when your transform needs to await (e.g. database lookups,
HTTP calls, inter-task channels).
Trait Implementations§
Source§impl Clone for TransformRegistry
impl Clone for TransformRegistry
Source§fn clone(&self) -> TransformRegistry
fn clone(&self) -> TransformRegistry
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TransformRegistry
impl !RefUnwindSafe for TransformRegistry
impl Send for TransformRegistry
impl Sync for TransformRegistry
impl Unpin for TransformRegistry
impl UnsafeUnpin for TransformRegistry
impl !UnwindSafe for TransformRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more