neon-bindings / examples

A collection of examples of Neon
324 stars 43 forks source link

Can't run tokio-fetch example #86

Closed caracal7 closed 2 years ago

caracal7 commented 2 years ago
error[E0282]: type annotations needed
  --> src/fetch.rs:26:10
   |
26 |         .downcast_or_throw::<JsObject, _>(cx)?;
   |          ^^^^^^^^^^^^^^^^^ cannot infer type
   |
   = note: type must be known at this point

error[E0599]: no method named `downcast_or_throw` found for struct `neon::handle::Handle<'_, _>` in the current scope
  --> src/fetch.rs:26:10
   |
26 |         .downcast_or_throw::<JsObject, _>(cx)?;
   |          ^^^^^^^^^^^^^^^^^ method not found in `neon::handle::Handle<'_, _>`
   |
   = note: the method was found for
           - `neon::handle::Handle<'a, T>`

Some errors have detailed explanations: E0282, E0599.
For more information about an error, try `rustc --explain E0282`.
kjvalencik commented 2 years ago

Thanks for the reminder! Examples were still based on a pre-release of 0.10 and there were breaking changes before it was released. In this case, JsObject::get now downcasts and it's not necessary to downcast separately.