pub struct BSHandle(/* private fields */);
Expand description
A handle to a running BS instance. Drop the handle to shutdown the associated background tasks.
Implementations§
Source§impl BSHandle
impl BSHandle
Sourcepub async fn get_env(&self) -> Result<Env<BSCtx, NoUserEvent>>
pub async fn get_env(&self) -> Result<Env<BSCtx, NoUserEvent>>
Get a copy of the current bscript environment
Sourcepub async fn compile(&self, text: ArcStr) -> Result<CompRes>
pub async fn compile(&self, text: ArcStr) -> Result<CompRes>
Compile and execute the specified bscript expression. It can either be a module expression or a single expression. If it generates results, they will be sent to all the channels that are subscribed.
Sourcepub async fn load(&self, path: PathBuf) -> Result<CompRes>
pub async fn load(&self, path: PathBuf) -> Result<CompRes>
Load and execute the specified bscript 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.
Sourcepub async fn delete(&self, id: ExprId) -> Result<Env<BSCtx, NoUserEvent>>
pub async fn delete(&self, id: ExprId) -> Result<Env<BSCtx, NoUserEvent>>
Delete the specified expression
Sourcepub async fn compile_callable(&self, id: Value) -> Result<Callable>
pub async fn compile_callable(&self, id: Value) -> Result<Callable>
Compile a callable interface to the specified lambda id. This is how you call a lambda directly from rust.
Sourcepub async fn compile_ref(&self, id: Value) -> Result<ExprId>
pub async fn compile_ref(&self, id: Value) -> Result<ExprId>
Compile an expression that will output the value of the ref specifed by id. This is the same as the deref (*) operator in bscript.