From f497a1fba437bbbc667010ec224ac1c1cec315ae Mon Sep 17 00:00:00 2001 From: Andrea Ciliberti Date: Thu, 6 Jul 2023 20:56:15 +0200 Subject: [PATCH] General setup for the new documentation --- README.md | 4 ++-- ctru-rs/Cargo.toml | 6 +++++- ctru-rs/src/lib.rs | 31 ++++++++++++++++++++++++++++--- ctru-rs/src/prelude.rs | 7 ++++++- ctru-rs/src/services/gfx.rs | 2 +- ctru-rs/src/services/mod.rs | 3 --- 6 files changed, 42 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index abd23dd..ae3e6c7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # ctru-rs -A Rust wrapper library for smealum's [ctrulib](https://github.com/smealum/ctrulib). +A Rust wrapper around [libctru](https://github.com/devkitPro/libctru). ## Structure @@ -8,7 +8,7 @@ This repository is organized as follows: * `ctru-rs`: Safe, idiomatic wrapper around `ctru-sys` -* `ctru-sys`: Low-level, unsafe bindings to ctrulib. +* `ctru-sys`: Low-level, unsafe bindings to `libctru`. This crate's version changes according to the version of `libctru` used to generate the bindings, with the following convention: diff --git a/ctru-rs/Cargo.toml b/ctru-rs/Cargo.toml index 2811900..bf2ec15 100644 --- a/ctru-rs/Cargo.toml +++ b/ctru-rs/Cargo.toml @@ -1,6 +1,6 @@ [package] authors = ["Rust3DS Org", "Ronald Kinard "] -description = "A safe wrapper around smealum's ctrulib." +description = "A safe wrapper around libctru" license = "Zlib" name = "ctru-rs" version = "0.7.1" @@ -45,6 +45,10 @@ std-threads = [] [package.metadata.cargo-3ds] romfs_dir = "examples/romfs" +[package.metadata.docs.rs] +default-target = "armv6k-nintendo-3ds" +cargo-args = ["-Z", "build-std"] + [[example]] name = "thread-basic" required-features = ["std-threads"] diff --git a/ctru-rs/src/lib.rs b/ctru-rs/src/lib.rs index 5b0ad40..92645dd 100644 --- a/ctru-rs/src/lib.rs +++ b/ctru-rs/src/lib.rs @@ -1,14 +1,39 @@ -//! Safe Rust wrapper around `libctru`. -//! -//! This library behaves as the main tool to access system-specific features and feature fixes. +//! Safe wrapper around `libctru`. +//! +//! # About +//! +//! This crate behaves as the main tool to access system-specific functionality on the Nintendo 3DS when developing homebrew software in Rust. +//! Thanks to it, developers can access the underlying system services and the console's hardware to develop userland applications +//! (such as HID devices, network capabilities, graphics, built-in cameras, etc.). +//! +//! Among these features, `ctru` also automatically includes functionality to properly integrate the Rust `std` with the console, which the developer would otherwise need to implement manually. +//! +//! # Usage +//! +//! Read thoroughly the official [`ctru` wiki](https://github.com/rust3ds/ctru-rs/wiki) which guides you through the setup needed to install the required toolchain and helpful tools. +//! After following the guide and understanding the many quirks of the Nintendo 3DS homebrew development environment, you can create a new project by including this crate as a dependency +//! of your project in your `Cargo.toml` manifest and build your binaries either manually (for the `armv6k-nintendo-3ds` target) or via [`cargo-3ds`](https://github.com/rust3ds/cargo-3ds). +//! +//! # Examples +//! +//! You can check out the examples provided with this crate which dive into most of the implemented functionality. +//! + #![crate_type = "rlib"] #![crate_name = "ctru"] +#![warn(missing_docs)] #![feature(test)] #![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" +)] +#![doc( + html_logo_url = "https://user-images.githubusercontent.com/11131775/225929072-2fa1741c-93ae-4b47-9bdf-af70f3d59910.png" +)] // Nothing is imported from these crates but their inclusion here assures correct linking of the missing implementations. extern crate pthread_3ds; diff --git a/ctru-rs/src/prelude.rs b/ctru-rs/src/prelude.rs index 74faa41..49095fa 100644 --- a/ctru-rs/src/prelude.rs +++ b/ctru-rs/src/prelude.rs @@ -1,2 +1,7 @@ pub use crate::console::Console; -pub use crate::services::{gfx::Gfx, hid::KeyPad, soc::Soc, Apt, Hid}; +pub use crate::services::{ + apt::Apt, + gfx::Gfx, + hid::{Hid, KeyPad}, + soc::Soc, +}; diff --git a/ctru-rs/src/services/gfx.rs b/ctru-rs/src/services/gfx.rs index 8c60280..a7ba708 100644 --- a/ctru-rs/src/services/gfx.rs +++ b/ctru-rs/src/services/gfx.rs @@ -211,7 +211,7 @@ static GFX_ACTIVE: Mutex = Mutex::new(0); impl Gfx { /// Creates a new [`Gfx`] instance with default init values /// It's the same as calling: - /// + /// /// ``` /// Gfx::with_formats(FramebufferFormat::Bgr8, FramebufferFormat::Bgr8, false) /// ``` diff --git a/ctru-rs/src/services/mod.rs b/ctru-rs/src/services/mod.rs index 1d31dea..d825c46 100644 --- a/ctru-rs/src/services/mod.rs +++ b/ctru-rs/src/services/mod.rs @@ -42,7 +42,4 @@ cfg_if::cfg_if! { } } -pub use self::apt::Apt; -pub use self::hid::Hid; - pub(crate) use self::reference::ServiceReference;