Skip to content

Instantly share code, notes, and snippets.

@habnabit
Last active March 8, 2016 18:08
Show Gist options
  • Save habnabit/62a20e395950d4b550ac to your computer and use it in GitHub Desktop.
Save habnabit/62a20e395950d4b550ac to your computer and use it in GitHub Desktop.
pebble.rs/src/pebble/mod.rs:72:41: 72:49 error: the trait `pebble::WindowWidget` is not implemented for the type `Box<pebble::WindowWidget>` [E0277]
pebble.rs/src/pebble/mod.rs:72 let ret: &'a mut WindowWidget = &mut *br;
^~~~~~~~
pebble.rs/src/pebble/mod.rs:72:41: 72:49 help: run `rustc --explain E0277` to see a detailed explanation
pebble.rs/src/pebble/mod.rs:72:41: 72:49 note: required for the cast to the object type `pebble::WindowWidget + 'a`
fn window_widget_from_raw_ptr<'a>(p: &'a mut *mut types::_Window) -> &'a mut WindowWidget {
let mut ws: &'a mut WindowStack = unsafe { &mut *(external::window_get_user_data(*p) as *mut _) };
let br: &'a mut Box<WindowWidget> = ws.windows.get_mut(*p as u32).unwrap();
let ret: &'a mut WindowWidget = &mut *br;
ret
}
fn window_widget_from_raw_ptr<'a>(p: &'a mut *mut types::_Window) -> &'a mut WindowWidget {
let mut ws: &'a mut WindowStack = unsafe { &mut *(external::window_get_user_data(*p) as *mut _) };
let br: &'a mut Box<WindowWidget> = ws.windows.get_mut(*p as u32).unwrap();
let ret: &'a mut WindowWidget = &mut **br;
ret
}
pebble.rs/src/pebble/mod.rs:75:9: 75:16 error: the trait `pebble::WindowWidget` is not implemented for the type `&mut Box<pebble::WindowWidget>` [E0277]
pebble.rs/src/pebble/mod.rs:75 &mut br
^~~~~~~
pebble.rs/src/pebble/mod.rs:75:9: 75:16 help: run `rustc --explain E0277` to see a detailed explanation
pebble.rs/src/pebble/mod.rs:75:9: 75:16 note: required for the cast to the object type `pebble::WindowWidget + 'a`
fn window_widget_from_raw_ptr<'a>(p: &'a mut *mut types::_Window) -> &'a mut WindowWidget {
let mut ws: &'a mut WindowStack = unsafe { &mut *(external::window_get_user_data(*p) as *mut _) };
let mut br = ws.windows.get_mut(*p as u32).unwrap();
&mut br
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment