antoyo / relm

Idiomatic, GTK+-based, GUI library, inspired by Elm, written in Rust
MIT License
2.43k stars 78 forks source link

Communication examples removed? #142

Closed netvl closed 5 years ago

netvl commented 5 years ago

I see here and in source code various references to non-existing examples, e.g.

/// Widget that was added by the `ContainerWidget::add_widget()` method.
///
/// ## Warning
/// You must keep your components as long as you want them to send/receive events.
/// Common practice is to store `Component`s in the `Widget` struct (see the [communication
/// example](https://github.com/antoyo/relm/blob/master/examples/communication.rs#L182-L188)).
/// The `#[widget]` attribute takes care of storing them in the struct automatically (see the
/// [communication-attribute example](https://github.com/antoyo/relm/blob/master/examples/communication-attribute.rs)).
#[must_use]
pub struct Component<WIDGET: Widget> {
    stream: EventStream<WIDGET::Msg>,
    widget: WIDGET::Root,
}

This is something which I need for my application (composition of components, that is), and it is really disconcerting not to have an example of how to do it, in particular, things like communication between components, in both ways (parent to child and back).

antoyo commented 5 years ago

Some examples were moved to the tests directory. So here is the communication example. I'll fix the comments. Thanks for reporting this issue.

antoyo commented 5 years ago

Fixed in 83f518f2b59843a232ecfd5ad25216e599eb3cb0.