Conversation
waywardmonkeys
left a comment
There was a problem hiding this comment.
Overall seems fine. A couple of minor nits. Good to see the WidgetMut stuff.
masonry/src/widgets/divider.rs
Outdated
| } | ||
|
|
||
| /// Removes any existing content. | ||
| pub fn remove_content(this: &mut WidgetMut<'_, Self>) { |
There was a problem hiding this comment.
Is remove_content a better name than clear_content? (Not sure)
There was a problem hiding this comment.
I do think clear_content is clearer in this context.
There was a problem hiding this comment.
Other existing widgets use both remove and clear, so we don't really have a clear winner. I changed this one to clear.
xilem/examples/to_do_mvc.rs
Outdated
| //! A to-do-list app, loosely inspired by todomvc. | ||
|
|
||
| use masonry::layout::AsUnit; | ||
| use masonry::widgets::DashFit; |
There was a problem hiding this comment.
These should go through xilem::masonry below ...
There was a problem hiding this comment.
Rust Analyzer strikes again!
There was a problem hiding this comment.
I'm really tempted to drop everything I'm doing and finally make a PR in RA to fix that.
This PR implements
Divideras a Xilem view. That will help get more usage of the widget and thereby exposes more issues. It already exposed thatWidgetMutmethods for editing an existingDividerwere not implemented, so this PR also adds those.One annoying thing is that the no-content
DividerXilem view still needs a content type that satisfiesWidgetView. I went with a default dummy ofSpinnerbecause it's a non-generic type. This allows for easy constructors likedivider_h(). The fact that the resulting type usesSpinneris quite hidden but keeps ergonomics better. For the full constructor, specifying it manually is still required, e.g.divider::<_, _, Spinner>(Axis::Horizontal, None). Of course anyWidgetViewcompatible type works as a dummy.I incorporated two examples of using the divider into
cargo run --example to_do_mvc.