Browse Source

Renew manifests and fix warnings

pull/134/head
Andrea Ciliberti 1 year ago
parent
commit
9b97e90484
  1. 1
      Cargo.toml
  2. 4
      ctru-rs/Cargo.toml
  3. 16
      ctru-rs/src/error.rs
  4. 7
      ctru-rs/src/lib.rs
  5. 2
      ctru-rs/src/services/gfx.rs
  6. 2
      ctru-rs/src/services/romfs.rs
  7. 4
      ctru-sys/Cargo.toml

1
Cargo.toml

@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
[workspace]
members = ["ctru-rs", "ctru-sys", "ctru-sys/bindgen-ctru-sys"]
default-members = ["ctru-rs", "ctru-sys"]
resolver = "2"
[patch.'https://github.com/rust3ds/ctru-rs']
# Make sure all dependencies use the local ctru-sys package

4
ctru-rs/Cargo.toml

@ -1,12 +1,14 @@ @@ -1,12 +1,14 @@
[package]
authors = ["Rust3DS Org", "Ronald Kinard <furyhunter600@gmail.com>"]
description = "A safe wrapper around libctru"
keywords = ["3ds", "libctru"]
categories = ["os", "api-bindings"]
license = "Zlib"
name = "ctru-rs"
version = "0.7.1"
edition = "2021"
repository = "https://github.com/rust3ds/ctru-rs"
rust-version = "1.64"
rust-version = "1.70"
[lib]
crate-type = ["rlib"]

16
ctru-rs/src/error.rs

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
//! Error handling interface.
//!
//!
//! This module holds the generic error and result types to interface with [`ctru_sys`] and the safe wrapper.
use std::borrow::Cow;
use std::error;
@ -10,16 +10,16 @@ use std::ops::{ControlFlow, FromResidual, Try}; @@ -10,16 +10,16 @@ use std::ops::{ControlFlow, FromResidual, Try};
use ctru_sys::result::{R_DESCRIPTION, R_LEVEL, R_MODULE, R_SUMMARY};
/// Custom type alias for generic `ctru` operations.
///
///
/// This type is compatible with `ctru-sys` result codes.
pub type Result<T> = ::std::result::Result<T, Error>;
/// Validity checker of raw [`ctru_sys::Result`] codes.
///
///
/// This struct supports the "try" syntax (`?`) to convert to an [`Error::Os`].
///
///
/// # Example
///
///
/// ```no_run
/// pub fn hid_init() -> crate::Result<()> {
/// // We run an unsafe function which returns a `ctru_sys::Result`.
@ -71,13 +71,13 @@ impl<T> FromResidual<Error> for Result<T> { @@ -71,13 +71,13 @@ impl<T> FromResidual<Error> for Result<T> {
}
/// The generic error enum returned by `ctru` functions.
///
///
/// This error enum supports parsing and displaying [`ctru_sys::Result`] codes.
#[non_exhaustive]
pub enum Error {
/// Raw [`ctru_sys::Result`] codes.
Os(ctru_sys::Result),
/// Generic `libc` error codes.
/// Generic `libc` error codes.
Libc(String),
/// Requested service is already active and cannot be activated again.
ServiceAlreadyActive,
@ -94,7 +94,7 @@ pub enum Error { @@ -94,7 +94,7 @@ pub enum Error {
impl Error {
/// Create an [`Error`] out of the last set value in `errno`.
///
///
/// This can be used to get a human-readable error string from calls to `libc` functions.
pub(crate) fn from_errno() -> Self {
let error_str = unsafe {

7
ctru-rs/src/lib.rs

@ -25,7 +25,6 @@ @@ -25,7 +25,6 @@
#![feature(custom_test_frameworks)]
#![feature(try_trait_v2)]
#![feature(allocator_api)]
#![feature(nonnull_slice_from_raw_parts)]
#![test_runner(test_runner::run)]
#![doc(
html_favicon_url = "https://user-images.githubusercontent.com/11131775/225929072-2fa1741c-93ae-4b47-9bdf-af70f3d59910.png"
@ -39,7 +38,7 @@ extern crate pthread_3ds; @@ -39,7 +38,7 @@ extern crate pthread_3ds;
extern crate shim_3ds;
/// Expanded stack size used to spawn the main thread by `libctru`.
///
///
/// This value was chosen to support crate dependencies which expected more stack than provided, without compromising performance.
#[no_mangle]
#[cfg(feature = "big-stack")]
@ -69,9 +68,9 @@ pub fn use_panic_handler() { @@ -69,9 +68,9 @@ pub fn use_panic_handler() {
}
/// Internal protocol to activate the custom panic handler hook.
///
///
/// # Notes
///
///
/// When `test` is enabled, this function will be ignored.
#[cfg(not(test))]
fn panic_hook_setup() {

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

@ -134,7 +134,7 @@ impl<S: Screen> Flush for S { @@ -134,7 +134,7 @@ impl<S: Screen> Flush for S {
let framebuffer = self.raw_framebuffer();
// Flush the data array. `self.raw_framebuffer` should get the correct parameters for all kinds of screens
unsafe {
let _ = unsafe {
ctru_sys::GSPGPU_FlushDataCache(
framebuffer.ptr.cast(),
(framebuffer.height * framebuffer.width) as u32,

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

@ -36,7 +36,7 @@ impl RomFS { @@ -36,7 +36,7 @@ impl RomFS {
},
|| {
let mount_name = CStr::from_bytes_with_nul(b"romfs\0").unwrap();
unsafe { ctru_sys::romfsUnmount(mount_name.as_ptr()) };
let _ = unsafe { ctru_sys::romfsUnmount(mount_name.as_ptr()) };
},
)?;

4
ctru-sys/Cargo.toml

@ -2,9 +2,13 @@ @@ -2,9 +2,13 @@
name = "ctru-sys"
version = "22.2.0+2.2.2-1"
authors = [ "Rust3DS Org", "Ronald Kinard <furyhunter600@gmail.com>" ]
description = "Raw bindings to libctru"
keywords = ["3ds", "libctru"]
categories = ["os", "external-ffi-bindings", "no-std"]
license = "Zlib"
links = "ctru"
edition = "2021"
repository = "https://github.com/rust3ds/ctru-rs"
[dependencies]
libc = { version = "0.2.121", default-features = false }

Loading…
Cancel
Save