yewstack/yew_router

Cannot run Component example, `send_back` method not found

Closed this issue · 6 comments

rhzs commented

Describe the Bug
Got error method not found error

   Compiling yew-router v0.8.0 (/Users/angel/Work/fbp/yew_router)
error[E0599]: no method named `send_back` found for type `yew::agent::AgentLink<agent::RouteAgent<T>>` in the current scope
  --> src/agent/mod.rs:97:29
   |
97 |         let callback = link.send_back(Msg::BrowserNavigationRouteChanged);
   |                             ^^^^^^^^^ method not found in `yew::agent::AgentLink<agent::RouteAgent<T>>`

error[E0282]: type annotations needed
  --> src/components/router_link.rs:53:26
   |
53 |                 onclick=|event | {
   |                          ^^^^^ consider giving this closure parameter a type
   |
   = note: type must be known at this point

error[E0599]: no method named `send_back` found for type `yew::html::ComponentLink<router::Router<T, SW, M>>` in the current scope
   --> src/router.rs:194:29
    |
194 |         let callback = link.send_back(Msg::UpdateRoute);
    |                             ^^^^^^^^^ method not found in `yew::html::ComponentLink<router::Router<T, SW, M>>`

warning: unused import: `stdweb::web::event::IEvent`
  --> src/components/router_link.rs:47:13
   |
47 |         use stdweb::web::event::IEvent;
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(unused_imports)]` on by default

error: aborting due to 3 previous errors

To Reproduce
Run cargo build in component example

Expected Behavior
should run the component example

Related Info

  • rustc version: 1.39
  • yew version: master branch
  • yew-router version: master branch
rhzs commented

It happens to all examples. None of the example works.

This is because of significant breaking changes being merged into yew:master.

Some work has been started here and should be merged later today: #188

Update: I did some work on #188 in the mean time you can run examples off of that branch, or use it as a temporary dependency.

Currently merging it into master is blocked on yewstack/yew#783 doing so first in its respective project. After both have been done, you can go back to using master for both.

Just merged #188 so everything should work on master now.

rhzs commented

@hgzimmerman it didn't work

➜ cargo build
   Compiling yew-router-route-parser v0.8.0 (/Users/angel/yew_router/crates/yew_router_route_parser)
   Compiling yew-router-macro v0.8.0 (/Users/angel/yew_router/crates/yew_router_macro)
   Compiling yew-router v0.8.0 (/Users/angel/yew_router)
error[E0407]: method `handle_input` is not a member of trait `Agent`
   --> src/agent/mod.rs:125:5
    |
125 | /     fn handle_input(&mut self, msg: Self::Input, who: HandlerId) {
126 | |         match msg {
127 | |             RouteRequest::ReplaceRoute(route) => {
128 | |                 let route_string: String = route.to_string();
...   |
162 | |         }
163 | |     }
    | |_____^ not a member of trait `Agent`

error[E0107]: wrong number of type arguments: expected 1, found 0
   --> src/router.rs:113:51
    |
113 | pub trait RenderFn<CTX: Component, SW>: Fn(SW) -> Html {}
    |                                                   ^^^^ expected 1 type argument

error[E0107]: wrong number of type arguments: expected 1, found 0
  --> src/components/router_button.rs:51:23
   |
51 |     fn view(&self) -> VNode {
   |                       ^^^^^ expected 1 type argument

error[E0107]: wrong number of type arguments: expected 1, found 0
  --> src/components/router_link.rs:51:23
   |
51 |     fn view(&self) -> VNode {
   |                       ^^^^^ expected 1 type argument

error[E0107]: wrong number of type arguments: expected 1, found 0
   --> src/router.rs:114:72
    |
114 | impl<T, CTX: Component, SW> RenderFn<CTX, SW> for T where T: Fn(SW) -> Html {}
    |                                                                        ^^^^ expected 1 type argument

error[E0107]: wrong number of type arguments: expected 1, found 0
   --> src/router.rs:227:23
    |
227 |     fn view(&self) -> VNode {
    |                       ^^^^^ expected 1 type argument

error: aborting due to 6 previous errors

Some errors have detailed explanations: E0107, E0407.
For more information about an error, try `rustc --explain E0107`.
error: could not compile `yew-router`.

To learn more, run the command again with --verbose.

Have you tried running cargo update, or removing the lock file present in your repository? This should allow cargo to download the most recent yew master, it looks like the Yew master you are using is slightly out of date.