Data source trait for providing graph values Implement this trait to provide data to the graph. The `sample` method is called for each horizontal position with a value in the x_range. # Examples ```rust use bgraph::DataSource; struct SineWave { frequency: f32 } impl DataSource for SineWave { fn sample(&self, x: f32) -> f32 { (x * self.frequency * 2.0 * std::f32::consts::PI).sin() } } ```
| 22 | /// } |
| 23 | /// ``` |
| 24 | pub trait DataSource { |
| 25 | /// Sample the data source at position `x` |
| 26 | fn sample(&self, x: f32) -> f32; |
| 27 | } |
| 28 | |
| 29 | // <FILE>src/traits/DataSource.rs</FILE> - <DESC>DataSource trait for graph data</DESC> |
| 30 | // <VERS>END OF VERSION: 1.0.0</VERS> |
nothing calls this directly
no outgoing calls
no test coverage detected