pub struct Scenario<T> { /* private fields */ }Expand description
The common module records and containers. These explicit facade exports keep ordinary callers out of the component crate paths. One named scenario and its optional probability.
Implementations§
Source§impl<T> Scenario<T>
impl<T> Scenario<T>
pub const fn new( id: ScenarioId, probability: Option<f64>, value: T, ) -> Scenario<T>
pub const fn id(&self) -> &ScenarioId
pub const fn probability(&self) -> Option<f64>
pub const fn value(&self) -> &T
Sourcepub const fn value_mut(&mut self) -> &mut T
pub const fn value_mut(&mut self) -> &mut T
Mutably borrow the scenario value. Identity and probability stay immutable so a set’s validated index and probability sum remain valid.
pub fn into_value(self) -> T
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Scenario<T>where
T: Freeze,
impl<T> RefUnwindSafe for Scenario<T>where
T: RefUnwindSafe,
impl<T> Send for Scenario<T>where
T: Send,
impl<T> Sync for Scenario<T>where
T: Sync,
impl<T> Unpin for Scenario<T>where
T: Unpin,
impl<T> UnsafeUnpin for Scenario<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Scenario<T>where
T: UnwindSafe,
Blanket Implementations§
impl<T> Allocation for T
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