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 compile(&self, text: ArcStr) -> Result<CompRes<X>>
pub async fn compile(&self, text: ArcStr) -> Result<CompRes<X>>
Compile and execute the specified 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: PathBuf) -> Result<CompRes<X>>
pub async fn load(&self, path: PathBuf) -> Result<CompRes<X>>
Load and execute the specified graphix module.
The path may have one of two forms. If it is the path to a file with
extension .bs then the rt will load the file directly. If it is a
modpath (e.g. foo::bar::baz) then the module resolver will look for a
matching module in the modpath. 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 the specified lambda id.
This is how you call a lambda directly from rust. When the returned
Callable is dropped the associated callsite will be delete.