Gip-Gip / egui-plotter

Simple to use utilties for integrating plotter into egui
MIT License
40 stars 15 forks source link

Dependency mismatch between example and Cargo.toml #18

Open kentakom1213 opened 3 months ago

kentakom1213 commented 3 months ago

Description

The code in the examples/ directory is unable to compile due to a mismatch between the dependencies specified in the Cargo.toml file and the versions of the dependencies used in the example code.

Steps to Reproduce

  1. Review the Cargo.toml file, which shows the following dependency versions:
[dependencies]
egui = "0.25.0"
eframe = "0.25.0"
plotters-backend = "0.3"
plotters = "0.3"
egui-plotter = "0.3.0"
  1. Run the example code located in the examples/ directory.
  2. Observe the following error message: (This is the case for examples/simple.rs)
error[E0308]: mismatched types
   --> src/main.rs:36:41
    |
36  |             let root = EguiBackend::new(ui).into_drawing_area();
    |                        ---------------- ^^ expected `&Ui`, found `&mut Ui`
    |                        |
    |                        arguments to this function are incorrect
    |
    = note: `Ui` and `egui::ui::Ui` have similar names, but are actually distinct types
note: `Ui` is defined in crate `egui`
   --> /home/<user>/.cargo/registry/src/index.crates.io-6f17d22bba15001f/egui-0.25.0/src/ui.rs:31:1
    |
31  | pub struct Ui {
    | ^^^^^^^^^^^^^
note: `egui::ui::Ui` is defined in crate `egui`
   --> /home/<user>/.cargo/registry/src/index.crates.io-6f17d22bba15001f/egui-0.22.0/src/ui.rs:31:1
    |
31  | pub struct Ui {
    | ^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `egui` are being used?
note: associated function defined here
   --> /home/<user>/.cargo/registry/src/index.crates.io-6f17d22bba15001f/egui-plotter-0.3.0/src/backend.rs:200:12
    |
200 |     pub fn new(ui: &'a Ui) -> Self {
    |            ^^^

For more information about this error, try `rustc --explain E0308`.
error: could not compile `metaheuristics` (bin "metaheuristics") due to 1 previous error

Expected Behavior

The example code should compile and run without any issues, using the dependency versions specified in the Cargo.toml file.

Actual Behavior

The example code fails to compile due to a mismatch between the dependency versions used in the code and the versions specified in the Cargo.toml file.

Proposed Solution

  1. Update the Cargo.toml file to use the same versions of the egui and eframe dependencies as the example code:
[dependencies]
egui = "0.22.0"  # <-- "0.25.0"
eframe = "0.22.0"  # <-- "0.25.0"
plotters-backend = "0.3"
plotters = "0.3"
egui-plotter = "0.3.0"
  1. Rebuild the project and run the example code again.

This should resolve the compilation issue and allow the example code to run successfully.

KevinKimSonos commented 1 month ago

Are there any updates on this?