Struct DataSource
pub struct DataSource {
market_data: Arc<dyn MarketDataSource>,
recipes: Option<Arc<dyn RecipeSource>>,
origin: Option<Arc<dyn Any + Send + Sync>>,
}Expand description
Where a market fetches its missing data from: market data, and optionally recipes. Cheap to clone — both are shared.
Fields§
§market_data: Arc<dyn MarketDataSource>§recipes: Option<Arc<dyn RecipeSource>>§origin: Option<Arc<dyn Any + Send + Sync>>The value the source was built from, where a binding wants it back — the Python object behind the ports, say. Never read by a fetch.
Implementations§
§impl DataSource
impl DataSource
pub fn new(market_data: Arc<dyn MarketDataSource>) -> Self
pub fn new(market_data: Arc<dyn MarketDataSource>) -> Self
Market data alone; recipes are the caller’s and the shipped ones.
pub fn with_origin(self, origin: Arc<dyn Any + Send + Sync>) -> Self
pub fn with_origin(self, origin: Arc<dyn Any + Send + Sync>) -> Self
This source remembering origin, the value it was built from.
pub fn origin(&self) -> Option<&(dyn Any + Send + Sync)>
pub fn origin(&self) -> Option<&(dyn Any + Send + Sync)>
The value this source was built from, where one was recorded.
pub fn with_recipes(self, recipes: Arc<dyn RecipeSource>) -> Self
pub fn with_recipes(self, recipes: Arc<dyn RecipeSource>) -> Self
This source also serving recipes from recipes.
pub fn market_data(&self) -> &dyn MarketDataSource
pub fn market_data(&self) -> &dyn MarketDataSource
The market-data port.
pub fn recipes(&self) -> Option<&dyn RecipeSource>
pub fn recipes(&self) -> Option<&dyn RecipeSource>
The recipe port, where the source serves recipes.
Trait Implementations§
§impl Clone for DataSource
impl Clone for DataSource
§fn clone(&self) -> DataSource
fn clone(&self) -> DataSource
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for DataSource
impl !UnwindSafe for DataSource
impl Freeze for DataSource
impl Send for DataSource
impl Sync for DataSource
impl Unpin for DataSource
impl UnsafeUnpin for DataSource
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more