Mention unit handing in value to string
This commit is contained in:
parent
2c6f65a342
commit
c3767831cd
2 changed files with 12 additions and 0 deletions
|
@ -57,6 +57,9 @@ pub struct FloatParam {
|
||||||
/// 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.
|
||||||
|
///
|
||||||
|
/// The input string may or may not contain the unit, so you will need to be able to handle
|
||||||
|
/// that.
|
||||||
pub string_to_value: Option<Arc<dyn Fn(&str) -> Option<f32> + Send + Sync>>,
|
pub string_to_value: Option<Arc<dyn Fn(&str) -> Option<f32> + Send + Sync>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,6 +272,9 @@ impl FloatParam {
|
||||||
/// Use a custom conversion function to convert from a string to a plain, unnormalized
|
/// Use a custom conversion function to convert from a string to a plain, unnormalized
|
||||||
/// value. If the string cannot be parsed, then this should return a `None`. If this
|
/// value. If 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.
|
/// happens while the parameter is being updated then the update will be canceled.
|
||||||
|
///
|
||||||
|
/// The input string may or may not contain the unit, so you will need to be able to handle
|
||||||
|
/// that.
|
||||||
pub fn with_string_to_value(
|
pub fn with_string_to_value(
|
||||||
mut self,
|
mut self,
|
||||||
callback: Arc<dyn Fn(&str) -> Option<f32> + Send + Sync>,
|
callback: Arc<dyn Fn(&str) -> Option<f32> + Send + Sync>,
|
||||||
|
|
|
@ -53,6 +53,9 @@ pub struct IntParam {
|
||||||
/// 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.
|
||||||
|
///
|
||||||
|
/// The input string may or may not contain the unit, so you will need to be able to handle
|
||||||
|
/// that.
|
||||||
pub string_to_value: Option<Arc<dyn Fn(&str) -> Option<i32> + Send + Sync>>,
|
pub string_to_value: Option<Arc<dyn Fn(&str) -> Option<i32> + Send + Sync>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,6 +242,9 @@ impl IntParam {
|
||||||
/// Use a custom conversion function to convert from a string to a plain, unnormalized
|
/// Use a custom conversion function to convert from a string to a plain, unnormalized
|
||||||
/// value. If the string cannot be parsed, then this should return a `None`. If this
|
/// value. If 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.
|
/// happens while the parameter is being updated then the update will be canceled.
|
||||||
|
///
|
||||||
|
/// The input string may or may not contain the unit, so you will need to be able to handle
|
||||||
|
/// that.
|
||||||
pub fn with_string_to_value(
|
pub fn with_string_to_value(
|
||||||
mut self,
|
mut self,
|
||||||
callback: Arc<dyn Fn(&str) -> Option<i32> + Send + Sync>,
|
callback: Arc<dyn Fn(&str) -> Option<i32> + Send + Sync>,
|
||||||
|
|
Loading…
Add table
Reference in a new issue