title: How to make a method in a class async using neon
body: <p>I am trying to make the method with a class created with neon and Rust async. but I m not sure how to do so for a class's method.
  For example, I would want to have myMethod as an async.</p>
  <pre><code>use neon::prelude::*;
  
  pub struct SomeClass{
      path: String,
  }
  declare_types! {
  
      pub class MyClass for SomeClass {
          init(mut cx) {
              let path = cx.argument::&lt;JsString&gt;(0)?.value(); 
              Ok(Predictor {
                  path: path ,
              })
          }
  
          method myMethod(mut cx) {
  
              let this = cx.this();
              let guard = cx.lock();
  
              let test = this.borrow(&amp;guard).path.unwrap();
              
              let vector = vec![1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3,];
              // Iterate over the Rust Vec and map each value in the Vec to the JS array
              let js_array = JsArray::new(&amp;mut cx, vector.len() as u32);
              for (i, obj) in preds.iter().enumerate() {
                  let element = cx.number(f64::from(*obj));
                  js_array.set(&amp;mut cx, i as u32, element).unwrap();
              }
  
              Ok(js_array.upcast())
          }
  
      }
  }
  
  // Export the class
  register_module!(mut m, {
      // &lt;JsEmployee&gt; tells neon what class we are exporting
      // &quot;Employee&quot; is the name of the export that the class is exported as
      m.export_class::&lt;myClass&gt;(&quot;MyClass&quot;)?;
      Ok(())
  });
  
  </code></pre>