Browse Source

General setup for the new documentation

pull/134/head
Andrea Ciliberti 1 year ago
parent
commit
f497a1fba4
  1. 4
      README.md
  2. 6
      ctru-rs/Cargo.toml
  3. 29
      ctru-rs/src/lib.rs
  4. 7
      ctru-rs/src/prelude.rs
  5. 3
      ctru-rs/src/services/mod.rs

4
README.md

@ -1,6 +1,6 @@
# ctru-rs # 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 ## Structure
@ -8,7 +8,7 @@ This repository is organized as follows:
* `ctru-rs`: Safe, idiomatic wrapper around `ctru-sys` * `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` This crate's version changes according to the version of `libctru`
used to generate the bindings, with the following convention: used to generate the bindings, with the following convention:

6
ctru-rs/Cargo.toml

@ -1,6 +1,6 @@
[package] [package]
authors = ["Rust3DS Org", "Ronald Kinard <furyhunter600@gmail.com>"] authors = ["Rust3DS Org", "Ronald Kinard <furyhunter600@gmail.com>"]
description = "A safe wrapper around smealum's ctrulib." description = "A safe wrapper around libctru"
license = "Zlib" license = "Zlib"
name = "ctru-rs" name = "ctru-rs"
version = "0.7.1" version = "0.7.1"
@ -45,6 +45,10 @@ std-threads = []
[package.metadata.cargo-3ds] [package.metadata.cargo-3ds]
romfs_dir = "examples/romfs" romfs_dir = "examples/romfs"
[package.metadata.docs.rs]
default-target = "armv6k-nintendo-3ds"
cargo-args = ["-Z", "build-std"]
[[example]] [[example]]
name = "thread-basic" name = "thread-basic"
required-features = ["std-threads"] required-features = ["std-threads"]

29
ctru-rs/src/lib.rs

@ -1,14 +1,39 @@
//! Safe Rust wrapper around `libctru`. //! Safe wrapper around `libctru`.
//! //!
//! This library behaves as the main tool to access system-specific features and feature fixes. //! # 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_type = "rlib"]
#![crate_name = "ctru"] #![crate_name = "ctru"]
#![warn(missing_docs)]
#![feature(test)] #![feature(test)]
#![feature(custom_test_frameworks)] #![feature(custom_test_frameworks)]
#![feature(try_trait_v2)] #![feature(try_trait_v2)]
#![feature(allocator_api)] #![feature(allocator_api)]
#![feature(nonnull_slice_from_raw_parts)] #![feature(nonnull_slice_from_raw_parts)]
#![test_runner(test_runner::run)] #![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. // Nothing is imported from these crates but their inclusion here assures correct linking of the missing implementations.
extern crate pthread_3ds; extern crate pthread_3ds;

7
ctru-rs/src/prelude.rs

@ -1,2 +1,7 @@
pub use crate::console::Console; 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,
};

3
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; pub(crate) use self::reference::ServiceReference;

Loading…
Cancel
Save