pub struct GXHandle<X: GXExt>(/* private fields */);Expand description
A handle to a running GX instance.
Drop the handle to shutdown the associated background tasks.
Implementations§
Source§impl<X: GXExt> GXHandle<X>
impl<X: GXExt> GXHandle<X>
Sourcepub async fn get_env(&self) -> Result<Env<GXRt<X>, X::UserEvent>>
pub async fn get_env(&self) -> Result<Env<GXRt<X>, X::UserEvent>>
Get a copy of the current graphix environment
Sourcepub async fn check(&self, path: ArcStr) -> Result<()>
pub async fn check(&self, path: ArcStr) -> Result<()>
Check that a graphix module compiles
If path startes with netidx: then the module will be loaded
from netidx, otherwise it will be loaded from the
filesystem. If the file compiles successfully return Ok(())
otherwise an error describing the problem. The environment
will not be altered by checking an expression, so you will not
be able to use any defined names later in the program. If you
want to do that see compile.
Sourcepub async fn compile(&self, text: ArcStr) -> Result<CompRes<X>>
pub async fn compile(&self, text: ArcStr) -> Result<CompRes<X>>
Compile and execute a graphix expression
If it generates results, they will be sent to all the channels that are
subscribed. When the CompExp objects contained in the CompRes are
dropped their corresponding expressions will be deleted. Therefore, you
can stop execution of the whole expression by dropping the returned
CompRes.
Sourcepub async fn load(&self, path: ArcStr) -> Result<CompRes<X>>
pub async fn load(&self, path: ArcStr) -> Result<CompRes<X>>
Load and execute a graphix module
If path startes with netidx: then the module will be loaded
from netidx, otherwise it will be loaded from the
filesystem. When the CompExp objects contained in the
CompRes are dropped their corresponding expressions will be
deleted. Therefore, you can stop execution of the whole file
by dropping the returned CompRes.
Sourcepub async fn compile_callable(&self, id: Value) -> Result<Callable<X>>
pub async fn compile_callable(&self, id: Value) -> Result<Callable<X>>
Compile a callable interface to a lambda id
This is how you call a lambda directly from rust. When the returned
Callable is dropped the associated callsite will be delete.
Sourcepub async fn compile_callable_by_name(
&self,
env: &Env<GXRt<X>, X::UserEvent>,
scope: &Scope,
name: &ModPath,
) -> Result<NamedCallable<X>>
pub async fn compile_callable_by_name( &self, env: &Env<GXRt<X>, X::UserEvent>, scope: &Scope, name: &ModPath, ) -> Result<NamedCallable<X>>
Compile a callable interface to a late bound function by name
This allows you to call a function by name. Because of late binding it
has some additional complexity (though less than implementing it
yourself). You must call update on NamedCallable when you recieve
updates from the runtime in order to drive late binding. update will
also return Some when one of your function calls returns.
Sourcepub async fn compile_ref(&self, id: impl Into<BindId>) -> Result<Ref<X>>
pub async fn compile_ref(&self, id: impl Into<BindId>) -> Result<Ref<X>>
Compile a ref to a bind id
This will NOT return an error if the id isn’t in the environment.