Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds type hinting in connect! macro #219

Closed
wants to merge 1 commit into from
Closed

Adds type hinting in connect! macro #219

wants to merge 1 commit into from

Conversation

sanpii
Copy link
Contributor

@sanpii sanpii commented Apr 13, 2020

Fixes #194

This is a side-effect because the first form of the connect macro also works with Relm as 3rd argument.

I added a type hinting, I hope the error message is clear:

error[E0308]: mismatched types
  --> examples/menu.rs:55:9
   |
55 |         connect!(quit_item, connect_activate(_), self.model.relm, Quit);
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `relm::component::Component`, found struct `relm::state::Relm`
   |
   = note: expected reference `&relm::component::Component<_>`
              found reference `&relm::state::Relm<Win>`
   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

@antoyo
Copy link
Owner

antoyo commented Jul 5, 2020

Sorry, I haven't had a chance to look at this yet.

@antoyo
Copy link
Owner

antoyo commented Feb 13, 2021

Sorry for the long delay.

I was wondering if we could remove one of the connect!'s macro branch instead of adding a type hint.

The first (look at the body in the connect_stream! macro here) and the third actually seem to have the exact same definition.

What do you think?

@sanpii
Copy link
Contributor Author

sanpii commented Feb 14, 2021

Ok, if it’s the same, I agree to delete one.

@sanpii sanpii closed this Feb 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Two syntaxes for event connect
2 participants