pub struct ConditionalParameter {
pub parameter: CategoricalParameter,
pub conditions: Vec<(String, ParameterValue)>,
pub require_all_conditions: bool,
}Expand description
Conditional parameter definition
Fields§
§parameter: CategoricalParameterBase parameter
conditions: Vec<(String, ParameterValue)>Conditions under which this parameter is active
require_all_conditions: boolWhether all conditions must be met (AND) or any (OR)
Implementations§
Source§impl ConditionalParameter
impl ConditionalParameter
Sourcepub fn new(
parameter: CategoricalParameter,
conditions: Vec<(String, ParameterValue)>,
) -> Self
pub fn new( parameter: CategoricalParameter, conditions: Vec<(String, ParameterValue)>, ) -> Self
Create a new conditional parameter
Sourcepub fn require_all_conditions(self, require_all: bool) -> Self
pub fn require_all_conditions(self, require_all: bool) -> Self
Set whether all conditions must be met
Sourcepub fn is_active(&self, params: &ParameterSet) -> bool
pub fn is_active(&self, params: &ParameterSet) -> bool
Check if this parameter is active given the current parameter set
Sourcepub fn sample_if_active(
&self,
params: &ParameterSet,
rng: &mut impl Rng,
) -> Option<ParameterValue>
pub fn sample_if_active( &self, params: &ParameterSet, rng: &mut impl Rng, ) -> Option<ParameterValue>
Sample from this parameter if it’s active
Trait Implementations§
Source§impl Clone for ConditionalParameter
impl Clone for ConditionalParameter
Source§fn clone(&self) -> ConditionalParameter
fn clone(&self) -> ConditionalParameter
Returns a duplicate of the value. Read more
1.0.0 · 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 Freeze for ConditionalParameter
impl RefUnwindSafe for ConditionalParameter
impl Send for ConditionalParameter
impl Sync for ConditionalParameter
impl Unpin for ConditionalParameter
impl UnwindSafe for ConditionalParameter
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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 more