Permalink
Browse files

Fix SimpleMsg derive

  • Loading branch information...
antoyo committed May 7, 2017
1 parent e81888d commit ca5887b42803a1428b9238955ede401dca3528ca
Showing with 12 additions and 4 deletions.
  1. +11 −4 relm-derive/src/lib.rs
  2. +1 −0 src/lib.rs
View
@@ -48,25 +48,32 @@ fn impl_simple_msg(ast: &MacroInput) -> Tokens {
let clone = derive_clone(ast);
let display = derive_display_variant(ast);
let generics = &ast.generics;
let generics_without_bound = remove_generic_bounds(generics);
let typ = quote! {
#name #generics_without_bound
};
let where_clause = gen_where_clause(&generics);
quote! {
#clone
#display
impl FnOnce<((),)> for #name {
type Output = #name;
impl #generics FnOnce<((),)> for #typ #where_clause {
type Output = #typ;
extern "rust-call" fn call_once(self, args: ((),)) -> Self::Output {
self.call(args)
}
}
impl FnMut<((),)> for #name {
impl #generics FnMut<((),)> for #typ #where_clause {
extern "rust-call" fn call_mut(&mut self, args: ((),)) -> Self::Output {
self.call(args)
}
}
impl Fn<((),)> for #name {
impl #generics Fn<((),)> for #typ #where_clause {
extern "rust-call" fn call(&self, _: ((),)) -> Self::Output {
self.clone()
}
View
@@ -391,6 +391,7 @@ pub fn init_test<WIDGET>(model_param: WIDGET::ModelParam) -> Result<Component<WI
where WIDGET: Widget + 'static,
WIDGET::Msg: Clone + DisplayVariant + 'static
{
futures_glib::init();
init_gtk();
let cx = MainContext::default(|cx| cx.clone());

0 comments on commit ca5887b

Please sign in to comment.