futu_backend/
command_runtime.rs1use async_trait::async_trait;
8use futu_command_runtime::{CommandRequest, CommandResponse, CommandTransport};
9use futu_core::error::FutuError;
10
11use crate::conn::BackendConn;
12
13pub use futu_command_runtime::{
14 CommandExecution, CommandExecutionContext, CommandExecutionOutcome, CommandOutcome,
15 CommandRuntime, CommandRuntimeAction, CommandRuntimeDecision, CommandRuntimeError,
16 decide_command_outcome,
17};
18
19#[async_trait]
20impl CommandTransport for BackendConn {
21 async fn execute(&self, request: CommandRequest) -> Result<CommandResponse, FutuError> {
22 let frame = self
23 .request_with_reserved(request.cmd_id, request.body.to_vec(), request.reserved)
24 .await?;
25 Ok(CommandResponse {
26 cmd_id: frame.header.cmd_id,
27 body: frame.body,
28 ex_head: frame.ex_head,
29 })
30 }
31}