pub struct PlotController {
pub model: PlotModel,
pub undo_stack: Vec<Command>,
pub redo_stack: Vec<Command>,
/* private fields */
}Expand description
EN: Main MVC controller. Owns model, data table, command history and notifications. RU: Glavnyy MVC-kontroller. Hranit model, tablitsu dannyh, istoriyu komand i uvedomleniya.
Fields§
§model: PlotModel§undo_stack: Vec<Command>§redo_stack: Vec<Command>Implementations§
Source§impl PlotController
impl PlotController
Sourcepub fn new() -> Self
pub fn new() -> Self
EN: Empty initial state; data is loaded via File menu. RU: Pustoe nachalnoe sostoyanie; dannye zagruzhayutsya cherez File menu.
Sourcepub fn notification(&self) -> Option<&Notification>
pub fn notification(&self) -> Option<&Notification>
Returns latest notification for status banner.
Sourcepub fn available_columns(&self) -> Vec<String>
pub fn available_columns(&self) -> Vec<String>
Returns names of all loaded numeric columns.
Sourcepub fn load_from_data_source(
&mut self,
source: &dyn DataSource,
) -> Result<(), ControllerError>
pub fn load_from_data_source( &mut self, source: &dyn DataSource, ) -> Result<(), ControllerError>
EN: Public API for embedding editor in another crate. RU: Public API dlya vstraivaniya redaktora v drugoy crate.
Examples found in repository?
examples/host_app.rs (line 54)
44fn main() -> Result<(), eframe::Error> {
45 let source = HostDataSource::demo();
46 let native_options = eframe::NativeOptions::default();
47 eframe::run_native(
48 "Host App + Embedded Plot Redactor",
49 native_options,
50 Box::new(move |cc| {
51 cc.egui_ctx.set_visuals(eframe::egui::Visuals::light());
52 let mut app = PlotEditorApp::new();
53 app.controller_mut()
54 .load_from_data_source(&source)
55 .expect("failed to load host data source");
56 Ok(Box::new(app))
57 }),
58 )
59}More examples
examples/host_app2.rs (line 54)
44fn main() -> Result<(), eframe::Error> {
45 let source = HostDataSource::demo();
46 let native_options = eframe::NativeOptions::default();
47 eframe::run_native(
48 "Host App + Embedded Plot Redactor",
49 native_options,
50 Box::new(move |cc| {
51 cc.egui_ctx.set_visuals(eframe::egui::Visuals::light());
52 let mut app = PlotEditorApp::new();
53 app.controller_mut()
54 .load_from_data_source(&source)
55 .expect("failed to load host data source");
56 Ok(Box::new(app))
57 }),
58 )
59}Sourcepub fn points_for_series(
&self,
series_id: SeriesId,
) -> Result<Vec<(f32, f32)>, ControllerError>
pub fn points_for_series( &self, series_id: SeriesId, ) -> Result<Vec<(f32, f32)>, ControllerError>
Returns currently selected (x, y) points for a series.
Auto Trait Implementations§
impl Freeze for PlotController
impl RefUnwindSafe for PlotController
impl Send for PlotController
impl Sync for PlotController
impl Unpin for PlotController
impl UnsafeUnpin for PlotController
impl UnwindSafe for PlotController
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.