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:
- native code on x86/arm with network access
- wasm in the browser sandbox, using wasm-bindgen to get a handle for sending and receiving data over the websocket.
Required Methods§
Sourcefn 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_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.
Sourcefn 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 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.
Provided Methods§
Sourcefn 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,
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".