Function relm::run
[−]
[src]
pub fn run<WIDGET>(model_param: WIDGET::ModelParam) -> Result<(), ()> where
WIDGET: Widget + 'static,
Create the specified relm Widget
and run the main event loops.
```
extern crate gtk;
#[macro_use]
extern crate relm;
#[macro_use]
extern crate relm_derive;
use gtk::{Window, WindowType};
use relm::{Relm, Widget};
struct Win {
window: Window,
}
impl Widget for Win {
type Model = ();
type ModelParam = ();
type Msg = Msg;
type Root = Window;
fn model(_: ()) -> () {
()
}
fn root(&self) -> &Self::Root {
&self.window
}
fn update(&mut self, event: Msg, model: &mut Self::Model) {
}
fn view(relm: &Relm, _model: &Self::Model) -> Self {
let window = Window::new(WindowType::Toplevel);
Win {
window: window,
}
}
}
#[derive(Msg)]
enum Msg {}
fn main() {
}
fn run() {
/// Win
is a relm Widget
.
Win::run(()).unwrap();