-
-
Notifications
You must be signed in to change notification settings - Fork 191
Allow chaining expressions with Closure objects #714
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
Conversation
I think |
That may not be straightforward as the macro was changed to just |
Maybe rename the first |
I just realized that it was named |
Well the ClosureExpression should only take a glib::Closure but we provide a helper constructor that takes a callback. So it's fine to not name it |
I see, maybe |
No strong opinions here, @sdroege ?:) |
Seems fine either way. Ask your favorite random number generator and go with that :) |
Let's go with this one then |
semi related to pr, maybe the ClosureExpression |
6ef52b5
to
44960e7
Compare
This is updated with the name changes, but it's a bit awkward with the recent addition of |
gtk4/src/closure_expression.rs
Outdated
@@ -23,16 +23,13 @@ define_expression!( | |||
|
|||
impl ClosureExpression { | |||
#[doc(alias = "gtk_closure_expression_new")] | |||
pub fn new<F, R>(params: impl IntoIterator<Item = impl AsRef<Expression>>, callback: F) -> Self | |||
pub fn new<R, I, E>(params: I, closure: glib::Closure) -> Self |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make it take a RustClosure ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It probably has to for type-safety reasons anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it to RustClosure
, if someone wants to add another function that takes just Closure
it should probably be unsafe anyway.
other than the cargo fmt, lgtm |
44960e7
to
e1931b6
Compare
Thanks! |
I had to change
ClosureExpression::with_closure
to expand out the generic parameters, it could be changed back depending on this: rust-lang/rust#83701Also includes some docs fixes.