With this library you can write rage:mp gamemodes directly in rust with the help of web assembly. The project is under construction, so feel free to contribuite.
git clone https://github.com/ghosty2004/wasm-for-rage.gitcargo install wasm-packwasm-pack build --target nodejs --release- create an empty resources in your ragemp server (for example 
packages/rust/index.js) with the following content: 
const wasm = require("./wasm_for_rage.js");
mp.events.add('packagesLoaded', () => {
  // create some vehicles to test rust's forEach :)
  for(let i = 0; i < 10; i++) mp.vehicles.new("infernus2", new mp.Vector3(0, 0, 0));
  // initialize the main of rust lib
  console.log(wasm.main()); // you can view the return value of `wasm.main()` from `/src/lib.rs` (it return a String)
});- build the rust library with the following command 
wasm-pack build --target nodejs --release - move 
wasm_for_rage_bg.wasmandwasm_for_rage.jsin your resources pathpackages/rust/ - start server
 
- bind all methods from ragemp (embedded nodejs) to rust
 
use wasm_bindgen::prelude::*;
use mp::Vector3;
#[allow(unused)]
mod mp;
#[wasm_bindgen]
extern "C" {
    #[wasm_bindgen(js_namespace = console, js_name = log)]
    pub fn console_log(value: String);
}
#[wasm_bindgen]
pub fn main() -> String {
    // create a vehicle
    if let Some(veh) = mp::vehicles::new(String::from("infernus2"), Vector3::new(0.0, 0.0, 0.0)) {
        console_log(format!("Created vehicle {}", veh.id()));
    } else {
        console_log(String::from("Failed to create vehicle"));
    }
    mp::vehicles::for_each(|vehicle| {
        vehicle.set_numberPlate(String::from("RUST"));
        console_log(format!("Vehicle numberPlate {}", vehicle.numberPlate()));
    });
    String::from("initialized") // this will be returned to node runtime (in our case the node from ragemp where it's embedded)
}