A32nx: Tracking: Using Rust for WASM Modules

Created on 10 Oct 2020  路  7Comments  路  Source: flybywiresim/a32nx

This weekend we have been working on a rust library for writing MSFS addons (https://github.com/devsnek/msfs-rs) and the library is now in what I would call an "MVP" stage. From this point, I would like to gauge interest in using this for the various wasm projects that are currently in progress, and if there is interest, I'd like to work with the relevant people to improve the library's coverage of the SDK and port code over.

Why would we want to use Rust instead of C/C++? (ordered by importance, in my opinion)

  • Memory safety and correctness (reduces the likelihood of our addons crashing)

    • Thread safety, for when MSFS adds threads

  • Supports WASM as a first-class target
  • Great standard library
  • People like Rust

cc @akaritakai @ThePilot916 @wpine215

Bug trackinmastemeta

Most helpful comment

I'm not against this. However, in fairness, I am also going to list some cons in the context of this request:
1) Asobo has said that they will make SDK changes in the future to accommodate developers like PMDG. These will likely be features we want/need, and so this library will need active maintenance with all SDK changes.
2) The Visual Studio add-on allows for debugging the WASM file against the C++ code that generated it. If we moved to Rust, would we lose this ability?

All 7 comments

I'm not against this. However, in fairness, I am also going to list some cons in the context of this request:
1) Asobo has said that they will make SDK changes in the future to accommodate developers like PMDG. These will likely be features we want/need, and so this library will need active maintenance with all SDK changes.
2) The Visual Studio add-on allows for debugging the WASM file against the C++ code that generated it. If we moved to Rust, would we lose this ability?

  1. ...

I'm planning to maintain the library as long as it's being used, though it would definitely be good to get some more people helping with it.

  1. ...

We looked at this a bunch yesterday. Visual Studio most likely is unable to provide the debug experience for rust, but newer editors like VSCode and CLion have proper rust support and should handle the debugging.

We looked at this a bunch yesterday. Visual Studio most likely is unable to provide the debug experience for rust, but newer editors like VSCode and CLion have proper rust support and should handle the debugging.

Is this something you can test now?
Does CLion have a free community version like visual studio does?

You can also access CLion (and the rest of jetbrains software) through github student backpack. VSCode is free. That being said, you don't need a big fancy IDE with a debugger to develop addons (I use vim), it's just something we should make sure we support.

I'd like to add that VSCode with the rust-analyzer plugin is considered one of the two main options for rust development and it's free and OSS. The other being intellij-rust, referred to here as CLion, and the plugin is OSS.

@akaritakai have you used the visual studio addon to debug WASM in MSFS?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PANAM741 picture PANAM741  路  3Comments

Snapmatics picture Snapmatics  路  3Comments

L-1011 picture L-1011  路  4Comments

maor561 picture maor561  路  4Comments

javiiberia picture javiiberia  路  3Comments