pub trait ParamMaybeMut<T> {
// Required method
fn param_maybe_mut(&mut self) -> Option<&mut T>;
}Expand description
Item of type T may have been set in a certain_map slot and returns Option<&mut T>.
When used as a trait bound, ParamMaybeMut<T> ensures that the constrained type implements
the param_maybe_mut method, which returns an Option<&mut T>. This allows the caller to
attempt to retrieve a mutable reference to the value of type T from the implementing
type, if it has been previously set in a certain_map slot using
ParamSet<T>.
By using the ParamMaybeMut<T> trait bound, you can handle cases where the value may or
may not have been set in the certain_map.
§Example
fn process_param_maybe_mut<P: ParamMaybeMut<T>, T>(param_provider: &mut P) {
if let Some(value_mut) = param_provider.param_maybe_mut() {
// Modify the value of type T
}
}