pub enum HostRegistration<P>where
P: ProcessManager,{
Stateful {
name: String,
meta: FuncMeta,
func: Arc<dyn Fn(&mut StepCtx<'_, P>, Vec<Value>) -> Result<Value, Error> + Sync + Send>,
},
Pure {
name: String,
meta: FuncMeta,
func: Arc<dyn Fn(Vec<Value>) -> Result<Value, Error> + Sync + Send>,
},
Both {
name: String,
meta: FuncMeta,
func: Arc<dyn Fn(&mut StepCtx<'_, P>, Vec<Value>) -> Result<Value, Error> + Sync + Send>,
template: Arc<dyn Fn(Vec<Value>) -> Result<Value, Error> + Sync + Send>,
},
}Expand description
One host-registered function, grouped into a HostModule and passed
to Engine::register_module. Build the entry with the #[oxdock_func]-
generated registration marker, or by hand. Pure entries run
on both the AST and the compiled RPN math paths; Stateful entries run
on the AST path with full step context. Both entries carry a stateful
body plus a pure string projection: every context with step IO runs
the body, while {{ }} placeholder expansion (which has no step
context) runs the projection.
Variants§
Implementations§
Source§impl<P> HostRegistration<P>where
P: ProcessManager,
impl<P> HostRegistration<P>where
P: ProcessManager,
Sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
Registry name this entry answers to. The lock test in tests.rs
(function_names_match_registry) asserts every
function_names::FUNC_* constant against this, so a rename of
the Rust function (which moves the macro-derived name) fails
loudly instead of leaving diagnostics text behind.
Trait Implementations§
Source§impl<P> Clone for HostRegistration<P>where
P: ProcessManager,
impl<P> Clone for HostRegistration<P>where
P: ProcessManager,
Source§fn clone(&self) -> HostRegistration<P>
fn clone(&self) -> HostRegistration<P>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<P> !RefUnwindSafe for HostRegistration<P>
impl<P> !UnwindSafe for HostRegistration<P>
impl<P> Forget for HostRegistration<P>
impl<P> Freeze for HostRegistration<P>where
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<FuncParam>: Freeze,
*const ArcInner<TypeTag> is !null: Freeze,
PhantomData<ArcInner<TypeTag>>: Freeze,
&'static TypeDescriptor: Freeze,
*const ArcInner<[Field]> is !null: Freeze,
PhantomData<ArcInner<[Field]>>: Freeze,
*const ArcInner<str> is !null: Freeze,
PhantomData<ArcInner<str>>: Freeze,
*const ArcInner<[TypeTag]> is !null: Freeze,
PhantomData<ArcInner<[TypeTag]>>: Freeze,
&'static str: Freeze,
&'static [Example]: Freeze,
*const ArcInner<dyn Fn(&mut StepCtx<'_, P>, Vec<Value>) -> Result<Value, Error> + Sync + Send> is !null: Freeze,
PhantomData<ArcInner<dyn Fn(&mut StepCtx<'_, P>, Vec<Value>) -> Result<Value, Error> + Sync + Send>>: Freeze,
*const ArcInner<dyn Fn(Vec<Value>) -> Result<Value, Error> + Sync + Send> is !null: Freeze,
PhantomData<ArcInner<dyn Fn(Vec<Value>) -> Result<Value, Error> + Sync + Send>>: Freeze,
impl<P> Move for HostRegistration<P>
impl<P> Send for HostRegistration<P>where
RawVecInner: Send,
Arc<TypeTag>: Send,
&'static TypeDescriptor: Send,
Arc<[Field]>: Send,
Arc<str>: Send,
Arc<[TypeTag]>: Send,
&'static [&'static str]: Send,
&'static str: Send,
&'static [ParamOption]: Send,
&'static [Example]: Send,
Arc<dyn Fn(&mut StepCtx<'_, P>, Vec<Value>) -> Result<Value, Error> + Sync + Send>: Send,
Arc<dyn Fn(Vec<Value>) -> Result<Value, Error> + Sync + Send>: Send,
impl<P> Sync for HostRegistration<P>
impl<P> Unpin for HostRegistration<P>where
*const u8 is !null: Unpin,
Arc<TypeTag>: Unpin,
&'static TypeDescriptor: Unpin,
Arc<[Field]>: Unpin,
Arc<str>: Unpin,
Arc<[TypeTag]>: Unpin,
&'static [&'static str]: Unpin,
&'static str: Unpin,
&'static [ParamOption]: Unpin,
&'static [Example]: Unpin,
Arc<dyn Fn(&mut StepCtx<'_, P>, Vec<Value>) -> Result<Value, Error> + Sync + Send>: Unpin,
Arc<dyn Fn(Vec<Value>) -> Result<Value, Error> + Sync + Send>: Unpin,
impl<P> UnsafeUnpin for HostRegistration<P>where
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<FuncParam>: UnsafeUnpin,
*const ArcInner<TypeTag> is !null: UnsafeUnpin,
PhantomData<ArcInner<TypeTag>>: UnsafeUnpin,
&'static TypeDescriptor: UnsafeUnpin,
*const ArcInner<[Field]> is !null: UnsafeUnpin,
PhantomData<ArcInner<[Field]>>: UnsafeUnpin,
*const ArcInner<str> is !null: UnsafeUnpin,
PhantomData<ArcInner<str>>: UnsafeUnpin,
*const ArcInner<[TypeTag]> is !null: UnsafeUnpin,
PhantomData<ArcInner<[TypeTag]>>: UnsafeUnpin,
&'static str: UnsafeUnpin,
&'static [Example]: UnsafeUnpin,
*const ArcInner<dyn Fn(&mut StepCtx<'_, P>, Vec<Value>) -> Result<Value, Error> + Sync + Send> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn Fn(&mut StepCtx<'_, P>, Vec<Value>) -> Result<Value, Error> + Sync + Send>>: UnsafeUnpin,
*const ArcInner<dyn Fn(Vec<Value>) -> Result<Value, Error> + Sync + Send> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn Fn(Vec<Value>) -> Result<Value, Error> + Sync + Send>>: UnsafeUnpin,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.