pub struct ScriptWriter { /* private fields */ }Expand description
Generate a scenario to be executed by the Company simulator.
Implementations§
Source§impl ScriptWriter
impl ScriptWriter
pub fn current_day(&self) -> i32
pub fn set_current_day(&self, value: i32) -> i32
Sourcepub fn initial_customers(&self) -> u32
pub fn initial_customers(&self) -> u32
How many customers we have the day 1
Sourcepub fn market_capacity(&self) -> u32
pub fn market_capacity(&self) -> u32
The maximum number of customer the company can have by the end of the simulation period.
Sourcepub fn inflection_point(&self) -> u32
pub fn inflection_point(&self) -> u32
Where customer base growth reaches its peak.
Sourcepub fn growth_rate(&self) -> f64
pub fn growth_rate(&self) -> f64
Company’s “success” rate – how fast the customer base grows
pub fn min_customer_orders(&self) -> f64
pub fn max_customer_orders(&self) -> f64
pub fn product_count(&self) -> i32
pub fn return_window(&self) -> i32
Sourcepub fn products(&self) -> RwLockReadGuard<'_, Vec<Product>>
pub fn products(&self) -> RwLockReadGuard<'_, Vec<Product>>
Index in the vector is the products ID.
pub fn products_mut(&self) -> RwLockWriteGuard<'_, Vec<Product>>
Sourcepub fn return_probs<'fx_reader_lifetime>(
&'fx_reader_lifetime self,
) -> MappedRwLockReadGuard<'fx_reader_lifetime, BTreeMap<i32, f64>>
pub fn return_probs<'fx_reader_lifetime>( &'fx_reader_lifetime self, ) -> MappedRwLockReadGuard<'fx_reader_lifetime, BTreeMap<i32, f64>>
Product return probability per day, by ID.
pub fn steps(&self) -> RwLockReadGuard<'_, Vec<Step>>
pub fn steps_mut(&self) -> RwLockWriteGuard<'_, Vec<Step>>
pub fn set_steps(&self, value: Vec<Step>) -> Vec<Step>
Sourcepub fn returns(&self) -> RwLockReadGuard<'_, HashMap<i32, Vec<Order>>>
pub fn returns(&self) -> RwLockReadGuard<'_, HashMap<i32, Vec<Order>>>
“Planned” returns, per day
pub fn returns_mut(&self) -> RwLockWriteGuard<'_, HashMap<i32, Vec<Order>>>
Sourcepub fn backorders(&self) -> RwLockReadGuard<'_, Vec<VecDeque<usize>>>
pub fn backorders(&self) -> RwLockReadGuard<'_, Vec<VecDeque<usize>>>
Backorders by their indices in the steps array, per product ID. When inventory is replenished, these orders will be processed first.
Since product ID is its vector index, we use a Vec here too.
pub fn backorders_mut(&self) -> RwLockWriteGuard<'_, Vec<VecDeque<usize>>>
pub fn total_backordered(&self) -> usize
pub fn clear_total_backordered(&self) -> Option<usize>
Sourcepub fn pending_orders(&self) -> RwLockReadGuard<'_, HashMap<i32, Vec<usize>>>
pub fn pending_orders(&self) -> RwLockReadGuard<'_, HashMap<i32, Vec<usize>>>
Pending orders by their indices in the steps array, keyed by shipping day. This is a map from the day to a queue of orders.
pub fn pending_orders_mut( &self, ) -> RwLockWriteGuard<'_, HashMap<i32, Vec<usize>>>
Sourcepub fn inventory(&self) -> RwLockReadGuard<'_, Vec<InventoryRecord>>
pub fn inventory(&self) -> RwLockReadGuard<'_, Vec<InventoryRecord>>
Inventory record per product ID. Since product ID is its vector index in self.products, we use a Vec here too.
pub fn inventory_mut(&self) -> RwLockWriteGuard<'_, Vec<InventoryRecord>>
Sourcepub fn shipments(&self) -> RwLockReadGuard<'_, BTreeMap<i32, Vec<Shipment>>>
pub fn shipments(&self) -> RwLockReadGuard<'_, BTreeMap<i32, Vec<Shipment>>>
Map shipment day into shipments.
pub fn shipments_mut( &self, ) -> RwLockWriteGuard<'_, BTreeMap<i32, Vec<Shipment>>>
Sourcepub fn product_shipping(&self) -> RwLockReadGuard<'_, BTreeMap<i32, i32>>
pub fn product_shipping(&self) -> RwLockReadGuard<'_, BTreeMap<i32, i32>>
Map product ID into the number of items currently shipping.
pub fn product_shipping_mut(&self) -> RwLockWriteGuard<'_, BTreeMap<i32, i32>>
Sourcepub fn customers(&self) -> RwLockReadGuard<'_, HashMap<String, Arc<Customer>>>
pub fn customers(&self) -> RwLockReadGuard<'_, HashMap<String, Arc<Customer>>>
Map unique email into customer.
pub fn customers_mut( &self, ) -> RwLockWriteGuard<'_, HashMap<String, Arc<Customer>>>
Sourcepub fn customer_counts(&self) -> RwLockReadGuard<'_, VecDeque<u32>>
pub fn customer_counts(&self) -> RwLockReadGuard<'_, VecDeque<u32>>
Customer counts over the last few days.
pub fn customer_counts_mut(&self) -> RwLockWriteGuard<'_, VecDeque<u32>>
Sourcepub fn customer_history_length(&self) -> usize
pub fn customer_history_length(&self) -> usize
Customer history length
Sourcepub fn next_day_customers(&self) -> usize
pub fn next_day_customers(&self) -> usize
Keep track of the number of customers that are expected to be registered the next day.
pub fn set_next_day_customers(&self, value: usize) -> usize
pub fn random_pool(&self) -> Arc<RndPool>
pub fn product_price_model<'fx_reader_lifetime>( &'fx_reader_lifetime self, ) -> MappedRwLockReadGuard<'fx_reader_lifetime, Arc<ProductModel>>
pub fn track_product(&self) -> Option<usize>
pub fn set_track_product(&self, value: usize) -> Option<usize>
pub fn clear_track_product(&self) -> Option<usize>
pub fn customer_sessions<'fx_reader_lifetime>( &'fx_reader_lifetime self, ) -> MappedRwLockReadGuard<'fx_reader_lifetime, Vec<Option<DbSession>>>
pub fn customer_sessions_mut<'fx_get_mut>( &'fx_get_mut self, ) -> MappedRwLockWriteGuard<'fx_get_mut, Vec<Option<DbSession>>>
pub fn new() -> Arc<Self>
Sourcepub fn builder() -> ScriptWriterBuilder
pub fn builder() -> ScriptWriterBuilder
Creates a new builder for this struct.
Source§impl ScriptWriter
impl ScriptWriter
Trait Implementations§
Source§impl Default for ScriptWriter
impl Default for ScriptWriter
Source§impl Parent for ScriptWriter
impl Parent for ScriptWriter
Source§type WeakSelf = Weak<ScriptWriter>
type WeakSelf = Weak<ScriptWriter>
fn __fxplus_myself_downgrade(&self) -> Weak<Self>
impl FXStruct for ScriptWriter
Auto Trait Implementations§
impl !Freeze for ScriptWriter
impl !RefUnwindSafe for ScriptWriter
impl Send for ScriptWriter
impl Sync for ScriptWriter
impl Unpin for ScriptWriter
impl !UnwindSafe for ScriptWriter
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.