Skip to main content

cu_profiler_core/backend/
banks_client.rs

1//! `BanksClient` backend — interface defined, implementation pending.
2//!
3//! Wraps a `BanksClient` against a test validator. Like [`super::ProgramTestBackend`]
4//! it is a v1 skeleton: the interface is stable but [`ExecutionBackend::run`]
5//! returns [`crate::Error::BackendUnimplemented`] for now.
6
7use crate::Result;
8use crate::backend::{ExecutionBackend, SimulationOutput};
9use crate::error::Error;
10use crate::metadata::BackendKind;
11use crate::scenario::Scenario;
12
13/// Backend that drives a `BanksClient`.
14#[derive(Debug, Clone, Default)]
15pub struct BanksClientBackend {
16    /// Optional RPC/validator endpoint the client should connect to.
17    pub endpoint: Option<String>,
18}
19
20impl BanksClientBackend {
21    /// Construct a backend, optionally targeting an endpoint.
22    #[must_use]
23    pub fn new(endpoint: Option<String>) -> Self {
24        Self { endpoint }
25    }
26}
27
28impl ExecutionBackend for BanksClientBackend {
29    fn kind(&self) -> BackendKind {
30        BackendKind::BanksClient
31    }
32
33    fn run(&self, _scenario: &Scenario) -> Result<SimulationOutput> {
34        Err(Error::BackendUnimplemented(
35            "banks-client (planned for a future release)".to_string(),
36        ))
37    }
38}