Skip to main content

KernelClient

Trait KernelClient 

Source
pub trait KernelClient {
Show 13 methods // Required methods fn execute<'life0, 'life1, 'async_trait>( &'life0 self, input: &'life1 str, ) -> Pin<Box<dyn Future<Output = ClientResult<ExecResult>> + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_var<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = ClientResult<Option<Value>>> + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn set_var<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, value: Value, ) -> Pin<Box<dyn Future<Output = ClientResult<()>> + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn list_vars<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ClientResult<Vec<(String, Value)>>> + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn cwd<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ClientResult<String>> + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn set_cwd<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, ) -> Pin<Box<dyn Future<Output = ClientResult<()>> + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn last_result<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ClientResult<ExecResult>> + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn reset<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ClientResult<()>> + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn ping<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ClientResult<String>> + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn shutdown<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ClientResult<()>> + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn read_blob<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = ClientResult<Vec<u8>>> + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn write_blob<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, content_type: &'life1 str, data: &'life2 [u8], ) -> Pin<Box<dyn Future<Output = ClientResult<String>> + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn delete_blob<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = ClientResult<bool>> + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait;
}
Expand description

Common interface for interacting with a kaish kernel.

Both EmbeddedClient and custom client implementations can implement this trait, allowing code to work with any client type.

Required Methods§

Source

fn execute<'life0, 'life1, 'async_trait>( &'life0 self, input: &'life1 str, ) -> Pin<Box<dyn Future<Output = ClientResult<ExecResult>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute kaish source code.

Returns the result of the last statement executed.

Source

fn get_var<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = ClientResult<Option<Value>>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get a variable value.

Source

fn set_var<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, value: Value, ) -> Pin<Box<dyn Future<Output = ClientResult<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Set a variable value.

Source

fn list_vars<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ClientResult<Vec<(String, Value)>>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List all variables.

Source

fn cwd<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ClientResult<String>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the current working directory.

Source

fn set_cwd<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, ) -> Pin<Box<dyn Future<Output = ClientResult<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Set the current working directory.

Source

fn last_result<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ClientResult<ExecResult>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the last execution result ($?).

Source

fn reset<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ClientResult<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Reset the kernel to initial state.

Source

fn ping<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ClientResult<String>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Ping the kernel (health check).

Source

fn shutdown<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ClientResult<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Shutdown the kernel.

Source

fn read_blob<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = ClientResult<Vec<u8>>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read a blob by ID.

Returns the blob contents as raw bytes.

Source

fn write_blob<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, content_type: &'life1 str, data: &'life2 [u8], ) -> Pin<Box<dyn Future<Output = ClientResult<String>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Write a blob and return its ID.

The blob is stored in /v/blobs/{id} and can be referenced via BlobRef.

Source

fn delete_blob<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = ClientResult<bool>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete a blob by ID.

Returns true if the blob was deleted, false if it didn’t exist.

Implementors§