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: PathBuf) -> Result<()>
pub async fn check(&self, path: PathBuf) -> Result<()>
Check that the specified file compiles and typechecks.
If the file will compile and type check 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 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.