pub trait DataClientFactory: Debug {
// Required methods
fn create(
&self,
name: &str,
config: &dyn ClientConfig,
cache: CacheView,
clock: Rc<RefCell<dyn Clock>>,
) -> Result<Box<dyn DataClient>>;
fn name(&self) -> &str;
fn config_type(&self) -> &str;
}Expand description
Factory trait for creating data client instances.
Implementations of this trait should create specific data client types (e.g., Binance, Bybit, Databento) based on the provided configuration.
Required Methods§
Sourcefn create(
&self,
name: &str,
config: &dyn ClientConfig,
cache: CacheView,
clock: Rc<RefCell<dyn Clock>>,
) -> Result<Box<dyn DataClient>>
fn create( &self, name: &str, config: &dyn ClientConfig, cache: CacheView, clock: Rc<RefCell<dyn Clock>>, ) -> Result<Box<dyn DataClient>>
Create a new data client instance.
Data clients receive a read-only cache view so adapters can query platform state during construction without mutating the cache.
§Errors
Returns an error if client creation fails.
Sourcefn config_type(&self) -> &str
fn config_type(&self) -> &str
Returns the supported configuration type name for this factory.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".