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. 31
      ctru-rs/src/lib.rs
  4. 7
      ctru-rs/src/prelude.rs
  5. 2
      ctru-rs/src/services/gfx.rs
  6. 3
      ctru-rs/src/services/mod.rs

4
README.md

@ -1,6 +1,6 @@ @@ -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: @@ -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:

6
ctru-rs/Cargo.toml

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
[package]
authors = ["Rust3DS Org", "Ronald Kinard <furyhunter600@gmail.com>"]
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 = [] @@ -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"]

31
ctru-rs/src/lib.rs

@ -1,14 +1,39 @@ @@ -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;

7
ctru-rs/src/prelude.rs

@ -1,2 +1,7 @@ @@ -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,
};

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

@ -211,7 +211,7 @@ static GFX_ACTIVE: Mutex<usize> = Mutex::new(0); @@ -211,7 +211,7 @@ static GFX_ACTIVE: Mutex<usize> = 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)
/// ```

3
ctru-rs/src/services/mod.rs

@ -42,7 +42,4 @@ cfg_if::cfg_if! { @@ -42,7 +42,4 @@ cfg_if::cfg_if! {
}
}
pub use self::apt::Apt;
pub use self::hid::Hid;
pub(crate) use self::reference::ServiceReference;

Loading…
Cancel
Save