Browse Source

Run cargo fix to make compatible with Rust 2021

pull/13/head
AzureMarker 3 years ago
parent
commit
a16234c4e1
No known key found for this signature in database
GPG Key ID: 47A133F3BF9D03D3
  1. 7
      ctru-rs/examples/buttons.rs
  2. 4
      ctru-rs/examples/hello-both-screens.rs
  3. 5
      ctru-rs/examples/hello-world.rs
  4. 14
      ctru-rs/examples/software-keyboard.rs
  5. 1
      ctru-rs/src/applets/swkbd.rs
  6. 6
      ctru-rs/src/lib.rs
  7. 5
      ctru-rs/src/services/fs.rs
  8. 2
      ctru-rs/src/services/hid.rs
  9. 2
      ctru-sys/src/lib.rs

7
ctru-rs/examples/buttons.rs

@ -1,7 +1,5 @@
extern crate ctru;
use ctru::gfx::Gfx;
use ctru::console::Console; use ctru::console::Console;
use ctru::gfx::Gfx;
use ctru::services::apt::Apt; use ctru::services::apt::Apt;
use ctru::services::hid::{Hid, KeyPad}; use ctru::services::hid::{Hid, KeyPad};
@ -29,7 +27,6 @@ fn main() {
// We only want to print when the keys we're holding now are different // We only want to print when the keys we're holding now are different
// from what they were on the previous frame // from what they were on the previous frame
if keys != old_keys { if keys != old_keys {
// Clear the screen // Clear the screen
console.clear(); console.clear();
@ -62,7 +59,7 @@ fn main() {
} }
if keys.intersects(KeyPad::KEY_START) { if keys.intersects(KeyPad::KEY_START) {
println!("See ya!"); println!("See ya!");
break break;
} }
} }

4
ctru-rs/examples/hello-both-screens.rs

@ -1,7 +1,5 @@
extern crate ctru;
use ctru::gfx::{Gfx, Screen};
use ctru::console::Console; use ctru::console::Console;
use ctru::gfx::{Gfx, Screen};
use ctru::services::apt::Apt; use ctru::services::apt::Apt;
use ctru::services::hid::{Hid, KeyPad}; use ctru::services::hid::{Hid, KeyPad};

5
ctru-rs/examples/hello-world.rs

@ -1,7 +1,5 @@
extern crate ctru;
use ctru::gfx::Gfx;
use ctru::console::Console; use ctru::console::Console;
use ctru::gfx::Gfx;
use ctru::services::apt::Apt; use ctru::services::apt::Apt;
use ctru::services::hid::{Hid, KeyPad}; use ctru::services::hid::{Hid, KeyPad};
@ -36,7 +34,6 @@ fn main() {
// Main application loop. // Main application loop.
while apt.main_loop() { while apt.main_loop() {
// Flushes and swaps the framebuffers when double-buffering // Flushes and swaps the framebuffers when double-buffering
// is enabled // is enabled
gfx.flush_buffers(); gfx.flush_buffers();

14
ctru-rs/examples/software-keyboard.rs

@ -1,10 +1,8 @@
extern crate ctru; use ctru::applets::swkbd::{Button, Swkbd};
use ctru::gfx::Gfx;
use ctru::console::Console; use ctru::console::Console;
use ctru::gfx::Gfx;
use ctru::services::apt::Apt; use ctru::services::apt::Apt;
use ctru::services::hid::{Hid, KeyPad}; use ctru::services::hid::{Hid, KeyPad};
use ctru::applets::swkbd::{Swkbd, Button};
fn main() { fn main() {
ctru::init(); ctru::init();
@ -34,10 +32,10 @@ fn main() {
// Raise the software keyboard. You can perform different actions depending on which // Raise the software keyboard. You can perform different actions depending on which
// software button the user pressed // software button the user pressed
match keyboard.get_utf8(&mut text) { match keyboard.get_utf8(&mut text) {
Ok(Button::Right) => println!("You entered: {}", text), Ok(Button::Right) => println!("You entered: {}", text),
Ok(Button::Left) => println!("Cancelled"), Ok(Button::Left) => println!("Cancelled"),
Ok(Button::Middle) => println!("How did you even press this?"), Ok(Button::Middle) => println!("How did you even press this?"),
Err(_) => println!("Oh noes, an error happened!"), Err(_) => println!("Oh noes, an error happened!"),
} }
} }

1
ctru-rs/src/applets/swkbd.rs

@ -1,3 +1,4 @@
use bitflags::bitflags;
use ctru_sys::{ use ctru_sys::{
self, swkbdInit, swkbdInputText, swkbdSetButton, swkbdSetFeatures, swkbdSetHintText, SwkbdState, self, swkbdInit, swkbdInputText, swkbdSetButton, swkbdSetFeatures, swkbdSetHintText, SwkbdState,
}; };

6
ctru-rs/src/lib.rs

@ -1,12 +1,6 @@
#![crate_type = "rlib"] #![crate_type = "rlib"]
#![crate_name = "ctru"] #![crate_name = "ctru"]
#[macro_use]
extern crate bitflags;
extern crate ctru_sys;
extern crate libc;
extern crate widestring;
/// Call this somewhere to force Rust to link some required crates /// Call this somewhere to force Rust to link some required crates
/// This is also a setup for some crate integration only available at runtime /// This is also a setup for some crate integration only available at runtime
/// ///

5
ctru-rs/src/services/fs.rs

@ -3,18 +3,17 @@
//! This module contains basic methods to manipulate the contents of the 3DS's filesystem. //! This module contains basic methods to manipulate the contents of the 3DS's filesystem.
//! Only the SD card is currently supported. //! Only the SD card is currently supported.
use bitflags::bitflags;
use std::ffi::OsString;
use std::io::Error as IoError; use std::io::Error as IoError;
use std::io::ErrorKind as IoErrorKind; use std::io::ErrorKind as IoErrorKind;
use std::io::Result as IoResult; use std::io::Result as IoResult;
use std::io::{Read, Seek, SeekFrom, Write}; use std::io::{Read, Seek, SeekFrom, Write};
use std::ffi::OsString;
use std::mem; use std::mem;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::ptr; use std::ptr;
use std::slice; use std::slice;
use std::sync::Arc; use std::sync::Arc;
use widestring::{WideCStr, WideCString}; use widestring::{WideCStr, WideCString};
bitflags! { bitflags! {

2
ctru-rs/src/services/hid.rs

@ -4,7 +4,7 @@
//! and circle pad information. It also provides information from the sound volume slider, //! and circle pad information. It also provides information from the sound volume slider,
//! the accelerometer, and the gyroscope. //! the accelerometer, and the gyroscope.
bitflags! { bitflags::bitflags! {
/// A set of flags corresponding to the button and directional pad /// A set of flags corresponding to the button and directional pad
/// inputs on the 3DS /// inputs on the 3DS
#[derive(Default)] #[derive(Default)]

2
ctru-sys/src/lib.rs

@ -3,6 +3,4 @@
#![allow(non_snake_case)] #![allow(non_snake_case)]
#![no_std] #![no_std]
extern crate libc;
include!("bindings.rs"); include!("bindings.rs");

Loading…
Cancel
Save