Browse Source

Fixed ownership of Screen borrow for Console

pull/22/head
Andrea Ciliberti 3 years ago
parent
commit
09271676b6
  1. 6
      ctru-rs/src/console.rs

6
ctru-rs/src/console.rs

@ -8,21 +8,21 @@ use crate::gfx::Screen; @@ -8,21 +8,21 @@ use crate::gfx::Screen;
pub struct Console<'screen> {
context: Box<PrintConsole>,
_screen: PhantomData<&'screen ()>,
_screen: Ref<'screen, dyn Screen>,
}
impl<'screen> Console<'screen> {
/// Initialize a console on the chosen screen, overwriting whatever was on the screen
/// previously (including other consoles). The new console is automatically selected for
/// printing.
pub fn init(screen: Ref<'screen, impl Screen>) -> Self {
pub fn init(screen: Ref<'screen, dyn Screen>) -> Self {
let mut context = Box::new(PrintConsole::default());
unsafe { consoleInit(screen.as_raw(), context.as_mut()) };
Console {
context,
_screen: PhantomData,
_screen: screen,
}
}

Loading…
Cancel
Save