koengit / trainspotting

1 stars 1 forks source link

Project build fails because of incompatible types in vis-rs #1

Open logicarl opened 4 years ago

logicarl commented 4 years ago

Description

When trying to build the project as described in the README, the build fails on a code issue in vis-rs:

error[E0609]: no field `node_names` on type `&rolling::input::staticinfrastructure::StaticInfrastructure`
  --> vis-rs/src/convert.rs:86:26
   |
86 |     let lookup_names = x.node_names.iter().map(|(k,v)| (*v,k.clone())).collect::<HashMap<usize,String>>();
   |                          ^^^^^^^^^^ unknown field
   |
   = note: available fields are: `nodes`, `objects`

It seems that there was a change in rolling which was not implemented in vis-rs. I tried fixing it by making two changes:

  1. changing vis-rs/src/convert.rs:86 to
    let lookup_names = x.nodes.iter().enumerate().map(|(k,v)| (k, v.other_node.to_string())).collect::<HashMap<usize,String>>();
  2. accordingly changing vis-rs/src/main.rs:86 to
    let (c,oe,pos) = convert::convert(&inf.0).expect("D-graph conversion failed");

    These changes satisfied the compiler and the build process continued, but later ran into a runtime error while building the docs:

thread 'main' panicked at 'Parser failed: Many([UnexpectedToken(1, "Number(19.0)"), UnexpectedToken(1, "\"edge\""), UnexpectedToken(1, "\"symbol\"")])

   0: failure::backtrace::internal::InternalBacktrace::new
             at /home/carl/.cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.7/src/backtrace/internal.rs:46
   1: failure::backtrace::Backtrace::new
             at /home/carl/.cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.7/src/backtrace/mod.rs:121
   2: <failure::error::error_impl::ErrorImpl as core::convert::From<F>>::from
             at /home/carl/.cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.7/src/error/error_impl.rs:19
   3: <failure::error::Error as core::convert::From<F>>::from
             at /home/carl/.cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.7/src/error/mod.rs:36
   4: vis_rs::parser::read_string
             at vis-rs/src/parser.rs:55
   5: vis_rs::main
             at vis-rs/src/main.rs:103
   6: std::rt::lang_start::{{closure}}
             at /rustc/f3e1a954d2ead4e2fc197c7da7d71e6c61bad196/src/libstd/rt.rs:67
   7: std::rt::lang_start_internal::{{closure}}
             at src/libstd/rt.rs:52
      std::panicking::try::do_call
             at src/libstd/panicking.rs:292
   8: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:78
   9: std::panicking::try
             at src/libstd/panicking.rs:270
      std::panic::catch_unwind
             at src/libstd/panic.rs:394
      std::rt::lang_start_internal
             at src/libstd/rt.rs:51
  10: std::rt::lang_start
             at /rustc/f3e1a954d2ead4e2fc197c7da7d71e6c61bad196/src/libstd/rt.rs:67
  11: main
  12: __libc_start_main
  13: _start

I am just a beginner in rust and do not understand how to solve the problem, and in what way my previous "fix" might have caused it. I am very interested in using your tool for my Bachelor's thesis and would appreciate your help very much.

Additional Dependencies

While trying to build trainspotting, I discovered some dependencies not described in the README and some changes that hat to be made to the Cargo.toml files due to deprecated code in newer crate versions. Maybe this is helpful for you too:

Additional Libraries:

Changes to Cargo.toml files:

Additional Cabal Dependencies:

luteberget commented 4 years ago

Hi Carl. Thanks for your interest in this project. This repository has accumulated a lot of various experimental software and mainly provides base modules for some other tools:

I will take a look at the problems you mentioned. But if you tell me more about what you want to achieve I can check that out specifically. Is it drawing of infrastructure you want to do?

logicarl commented 4 years ago

Hi Bjørnar, Thank you for your answer! The junction repository is what I am looking for. That solves my problem and I will work with that from now on. My mistake was that I only read to chapter 3 of your PhD thesis and did not notice the description of the junction tool in the appendix.

I am still in the early stages, but my goal will be to augment your capacity verification by checking for robustness. For now, I just want to familiarize myself with the tool and the code.

luteberget commented 4 years ago

Great, that sounds cool. I would love to see the result when you're finished.

We have actually improved on the text on capacity verification since I made the PhD thesis. Email me if you would like a copy.