From aebf347a001835bb486434073e43216d21619d43 Mon Sep 17 00:00:00 2001 From: AzureMarker Date: Mon, 31 Jan 2022 20:38:13 -0800 Subject: [PATCH 1/2] Fix clippy warning about unused screen field --- ctru-rs/src/console.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ctru-rs/src/console.rs b/ctru-rs/src/console.rs index ec03a3d..ddd4fe8 100644 --- a/ctru-rs/src/console.rs +++ b/ctru-rs/src/console.rs @@ -9,7 +9,7 @@ static mut EMPTY_CONSOLE: PrintConsole = unsafe { const_zero::const_zero!(PrintC pub struct Console<'screen> { context: Box, - screen: RefMut<'screen, dyn Screen>, + _screen: RefMut<'screen, dyn Screen>, } impl<'screen> Console<'screen> { @@ -21,7 +21,10 @@ impl<'screen> Console<'screen> { unsafe { consoleInit(screen.as_raw(), context.as_mut()) }; - Console { context, screen } + Console { + context, + _screen: screen, + } } /// Returns true if a valid Console to print on is selected From c59de27f853dc69bb8087cad074f06bba591d444 Mon Sep 17 00:00:00 2001 From: Andrea Ciliberti Date: Tue, 1 Feb 2022 18:37:17 +0100 Subject: [PATCH 2/2] Removed link field in ctru-sys --- ctru-rs/examples/hello-world.rs | 22 ++++++++++++++-------- ctru-sys/Cargo.toml | 1 - 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/ctru-rs/examples/hello-world.rs b/ctru-rs/examples/hello-world.rs index 930549f..d617223 100644 --- a/ctru-rs/examples/hello-world.rs +++ b/ctru-rs/examples/hello-world.rs @@ -12,16 +12,22 @@ fn main() { let apt = Apt::init().expect("Couldn't obtain APT controller"); let _console = Console::init(gfx.top_screen.borrow_mut()); - let out = b"Hello fellow Rustaceans, I'm on the Nintendo 3DS!"; - let width = 24; - - let mut writer = BufWriter::new(Vec::new()); - ferris_says::say(out, width, &mut writer).unwrap(); + struct Timespec { + t: libc::timespec, + } + //let inst = std::time::Instant::now(); + let mut t = Timespec { t: libc::timespec { tv_sec: 0, tv_nsec: 0 } }; + let res = unsafe { libc::clock_gettime(libc::CLOCK_MONOTONIC, &mut t.t) }; + println!("{{tv_sec: {}, tv_nsec: {} }} {} clock:{}", t.t.tv_sec, t.t.tv_nsec, res, libc::CLOCK_MONOTONIC); + ctru::thread::sleep(std::time::Duration::from_secs(2)); + /*let ela = inst.elapsed(); println!( - "\x1b[0;0H{}", - String::from_utf8_lossy(&writer.into_inner().unwrap()) - ); + "\x1b[0;0HElapsed: {:#?}", + ela + );*/ + + // Main loop while apt.main_loop() { diff --git a/ctru-sys/Cargo.toml b/ctru-sys/Cargo.toml index 8c059bb..46bed0b 100644 --- a/ctru-sys/Cargo.toml +++ b/ctru-sys/Cargo.toml @@ -3,7 +3,6 @@ name = "ctru-sys" version = "0.4.0" authors = ["Ronald Kinard "] license = "https://en.wikipedia.org/wiki/Zlib_License" -links = "ctru" edition = "2021" [dependencies]