Function relm::init_test
[−]
[src]
pub fn init_test<WIDGET>(
model_param: WIDGET::ModelParam
) -> Result<Component<WIDGET>, ()> where
WIDGET: Widget + 'static,
WIDGET::Msg: DisplayVariant + 'static,
Initialize a widget for a test.
It is to be used this way: ```
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() {
let component = relm::init_test::