Rust API
The API documentation is generated by rustdoc. Locally:
bash
cargo doc --workspace --exclude ferrochart-py --no-deps --openPublished on docs.rs:
| Crate | Contents |
|---|---|
ferrochart-core | Chart, data model, scales, input, Frame, Renderer trait, transform_helpers |
ferrochart-render-wgpu | GpuContext, WgpuRenderer (surface or offscreen) |
ferrochart-render-cpu | CpuRenderer (tiny-skia) |
ferrochart-text | TextEngine, the bundled font |
ferrochart-winit | run, ChartApp, InputConverter |
ferrochart-indicators | Incremental indicators |
ferrochart-orderflow | Footprint, heatmap and TPO series (Order flow) |
Extending the chart (layers, custom series, native GPU series, transforms, drawing tools) is described in Plugins.
Where to start
ferrochart_core::Chart: create it withChartOptions,resize, add series, set data, feedInputEvents withhandle_input,build_frame, read events withdrain_events.ferrochart_core::render::Renderer: implemented by both renderers; you callrender(chart.frame(), &chart.data_view()).
Rules the API follows
- No panics. Methods that can fail return
Result; lookups by id returnResultorOption. - No allocations on the hot path. Panning, zooming, moving the crosshair
(
build_frame) andupdate_lastallocate nothing once warmed up; tests assert this with a counting allocator. - Typed coordinates.
CssandPx(and the point, size and rect types built on them) keep CSS and device pixels apart; the device pixel ratio is passed toChart::resize. - Core is pure.
ferrochart-corehas no dependencies outside the standard library (smallvecis the only one allowed): no GPU, window, font, time or async libraries, and nounsafe.