Sample a data source safely. Panics are caught and non-finite values become 0.0.
(data: &dyn DataSource, x: f32)
| 10 | |
| 11 | /// Sample a data source safely. Panics are caught and non-finite values become 0.0. |
| 12 | pub(crate) fn sample_f32(data: &dyn DataSource, x: f32) -> f32 { |
| 13 | let value = catch_unwind(AssertUnwindSafe(|| data.sample(x))).unwrap_or(0.0); |
| 14 | sanitize_value(value) |
| 15 | } |
| 16 | |
| 17 | // <FILE>src/functions/fnc_sample.rs</FILE> - <DESC>Safe sampling helpers for DataSource</DESC> |
| 18 | // <VERS>END OF VERSION: 1.0.0</VERS> |
no test coverage detected