Swap around trait bound order
This commit is contained in:
parent
b76b6e4a9b
commit
c286958c63
|
@ -17,6 +17,6 @@
|
||||||
//! Convenience functions for formatting and parsing parameter values in common formats.
|
//! Convenience functions for formatting and parsing parameter values in common formats.
|
||||||
|
|
||||||
/// Round an `f32` value to always have a specific number of decimal digits.
|
/// Round an `f32` value to always have a specific number of decimal digits.
|
||||||
pub fn f32_rounded(digits: usize) -> Option<Box<dyn Send + Sync + Fn(f32) -> String>> {
|
pub fn f32_rounded(digits: usize) -> Option<Box<dyn Fn(f32) -> String + Send + Sync>> {
|
||||||
Some(Box::new(move |x| format!("{:.digits$}", x)))
|
Some(Box::new(move |x| format!("{:.digits$}", x)))
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,11 +55,11 @@ pub struct PlainParam<T> {
|
||||||
/// The parameter value's unit, added after `value_to_string` if that is set.
|
/// The parameter value's unit, added after `value_to_string` if that is set.
|
||||||
pub unit: &'static str,
|
pub unit: &'static str,
|
||||||
/// Optional custom conversion function from a plain **unnormalized** value to a string.
|
/// Optional custom conversion function from a plain **unnormalized** value to a string.
|
||||||
pub value_to_string: Option<Box<dyn Send + Sync + Fn(T) -> String>>,
|
pub value_to_string: Option<Box<dyn Fn(T) -> String + Send + Sync>>,
|
||||||
/// Optional custom conversion function from a string to a plain **unnormalized** value. If the
|
/// Optional custom conversion function from a string to a plain **unnormalized** value. If the
|
||||||
/// string cannot be parsed, then this should return a `None`. If this happens while the
|
/// string cannot be parsed, then this should return a `None`. If this happens while the
|
||||||
/// parameter is being updated then the update will be canceled.
|
/// parameter is being updated then the update will be canceled.
|
||||||
pub string_to_value: Option<Box<dyn Send + Sync + Fn(&str) -> Option<T>>>,
|
pub string_to_value: Option<Box<dyn Fn(&str) -> Option<T> + Send + Sync>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A simple boolean parmaeter.
|
/// A simple boolean parmaeter.
|
||||||
|
@ -70,11 +70,11 @@ pub struct BoolParam {
|
||||||
/// The parameter's human readable display name.
|
/// The parameter's human readable display name.
|
||||||
pub name: &'static str,
|
pub name: &'static str,
|
||||||
/// Optional custom conversion function from a boolean value to a string.
|
/// Optional custom conversion function from a boolean value to a string.
|
||||||
pub value_to_string: Option<Box<dyn Send + Sync + Fn(bool) -> String>>,
|
pub value_to_string: Option<Box<dyn Fn(bool) -> String + Send + Sync>>,
|
||||||
/// Optional custom conversion function from a string to a boolean value. If the string cannot
|
/// Optional custom conversion function from a string to a boolean value. If the string cannot
|
||||||
/// be parsed, then this should return a `None`. If this happens while the parameter is being
|
/// be parsed, then this should return a `None`. If this happens while the parameter is being
|
||||||
/// updated then the update will be canceled.
|
/// updated then the update will be canceled.
|
||||||
pub string_to_value: Option<Box<dyn Send + Sync + Fn(&str) -> Option<bool>>>,
|
pub string_to_value: Option<Box<dyn Fn(&str) -> Option<bool> + Send + Sync>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Describes a single parmaetre of any type.
|
/// Describes a single parmaetre of any type.
|
||||||
|
|
Loading…
Reference in a new issue