MCPcopy Create free account
hub / github.com/5ocworkshop/bgraph / DataSource

Interface DataSource

src/traits/data_source.rs:24–27  ·  view source on GitHub ↗

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() } } ```

Source from the content-addressed store, hash-verified

22/// }
23/// ```
24pub 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>

Callers

nothing calls this directly

Implementers 6

cls_fn_data_source.rssrc/classes/cls_fn_data_source.rs
cls_time_series_state.rssrc/classes/cls_time_series_state.rs
test_cls_dual_graph.rstests/classes/test_cls_dual_graph.rs
test_cls_multi_graph.rstests/classes/test_cls_multi_graph.rs
test_fnc_get_braille_symbols.rstests/functions/test_fnc_get_braille_s
simple.rsexamples/simple.rs

Calls

no outgoing calls

Tested by

no test coverage detected