Skip to main content

EngineTransport

Trait EngineTransport 

Source
pub trait EngineTransport:
    Send
    + Sync
    + 'static {
    // Required methods
    fn inner_fire_modeling_cmd<'life0, 'async_trait>(
        &'life0 self,
        cmd_id: Uuid,
        source_range: SourceRange,
        cmd: WebSocketRequest,
        id_to_source_range: HashMap<Uuid, SourceRange>,
    ) -> Pin<Box<dyn Future<Output = Result<(), KclError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn inner_send_modeling_cmd<'life0, 'async_trait>(
        &'life0 self,
        cmd_id: Uuid,
        source_range: SourceRange,
        cmd: WebSocketRequest,
        id_to_source_range: HashMap<Uuid, SourceRange>,
    ) -> Pin<Box<dyn Future<Output = Result<WebSocketResponse, KclError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn close<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), TransportCloseError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn start_new_session<'life0, 'async_trait>(
        &'life0 self,
        _source_range: SourceRange,
    ) -> Pin<Box<dyn Future<Output = Result<(), KclError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Handles sending requests to the engine, and waiting for responses. Should have at least two implementations:

  1. native code on x86/arm with network access
  2. wasm in the browser sandbox, using wasm-bindgen to get a handle for sending and receiving data over the websocket.

Required Methods§

Source

fn inner_fire_modeling_cmd<'life0, 'async_trait>( &'life0 self, cmd_id: Uuid, source_range: SourceRange, cmd: WebSocketRequest, id_to_source_range: HashMap<Uuid, SourceRange>, ) -> Pin<Box<dyn Future<Output = Result<(), KclError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Send a modeling command without waiting for any response.

Source

fn inner_send_modeling_cmd<'life0, 'async_trait>( &'life0 self, cmd_id: Uuid, source_range: SourceRange, cmd: WebSocketRequest, id_to_source_range: HashMap<Uuid, SourceRange>, ) -> Pin<Box<dyn Future<Output = Result<WebSocketResponse, KclError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Send a modeling command, wait for a response.

Source

fn close<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), TransportCloseError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Close connection to the engine, clean up resources.

Provided Methods§

Source

fn start_new_session<'life0, 'async_trait>( &'life0 self, _source_range: SourceRange, ) -> Pin<Box<dyn Future<Output = Result<(), KclError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

If client is reused across sessions, implement this to clear sessions.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§