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

Improve flexibility of message sending API #932

Closed
jstarry opened this issue Feb 10, 2020 · 7 comments
Closed

Improve flexibility of message sending API #932

jstarry opened this issue Feb 10, 2020 · 7 comments

Comments

@jstarry
Copy link
Member

jstarry commented Feb 10, 2020

The message sending api for ComponentLink<_> could be more flexible and user-friendly if it accepted Into<Msg> instead of Msg.

pub fn batch_callback<F, IN>(&self, function: F) -> Callback<IN>
where
    F: Fn(IN) -> Vec<COMP::Message> + 'static;

pub fn callback<F, IN>(&self, function: F) -> Callback<IN>
where
    F: Fn(IN) -> COMP::Message + 'static;

pub fn send_message(&mut self, msg: COMP::Message);

pub fn send_message_batch(&mut self, msgs: Vec<COMP::Message>);

More flexibility with Into<COMP::Message>

pub fn batch_callback<F, IN>(&self, function: F) -> Callback<IN>
where
    F: Fn(IN) -> Vec<Into<COMP::Message>> + 'static;

pub fn callback<F, IN>(&self, function: F) -> Callback<IN>
where
    F: Fn(IN) -> Into<COMP::Message> + 'static;

pub fn send_message(&mut self, msg: Into<COMP::Message>);

pub fn send_message_batch(&mut self, msgs: Vec<Into<COMP::Message>>);
@Manish-Giri
Copy link

@jstarry Hello, may I take this up? Another contributor has already submitted a few issues corresponding to the todos, before I could assemble all of them, so maybe I can help out here instead.

@jstarry
Copy link
Member Author

jstarry commented Feb 12, 2020

@Manish-Giri yes, sounds great. Appreciate the help :)

@jstarry
Copy link
Member Author

jstarry commented Feb 28, 2020

Hey @Manish-Giri, how's it going? Have you had time to look into this yet? I'm happy to help if you have any questions!

@captain-yossarian
Copy link
Contributor

@jstarry if @Manish-Giri does not mind, I will pick it up

@jstarry
Copy link
Member Author

jstarry commented Mar 4, 2020

@captain-yossarian go for it

@lukerandall
Copy link
Contributor

@jstarry I believe this is resolved by #999

@jstarry
Copy link
Member Author

jstarry commented Apr 23, 2020

Ah yup, thanks!

@jstarry jstarry closed this as completed Apr 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants