From 0ba5c5d2e3c8fac958114e781336dfa5adc3c91e Mon Sep 17 00:00:00 2001 From: Alexander Koz Date: Sat, 10 Feb 2024 19:51:40 +0400 Subject: [PATCH] =?UTF-8?q?improve=20playdate-sys=20docs=20=F0=9F=A4=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 2 +- api/sys/Cargo.toml | 2 +- api/sys/src/log.rs | 2 ++ api/sys/src/sys/allocator.rs | 3 +++ api/sys/src/sys/error/mod.rs | 2 ++ api/sys/src/sys/macros.rs | 5 ++++- api/sys/src/sys/panic.rs | 1 + api/sys/src/sys/proc.rs | 3 +++ 8 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index dac27f8c..50704ee6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2771,7 +2771,7 @@ dependencies = [ [[package]] name = "playdate-sys" -version = "0.2.14" +version = "0.2.16" dependencies = [ "arrayvec", "playdate-bindgen", diff --git a/api/sys/Cargo.toml b/api/sys/Cargo.toml index fab10c6a..d0867b0d 100644 --- a/api/sys/Cargo.toml +++ b/api/sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "playdate-sys" -version = "0.2.15" +version = "0.2.16" build = "src/build.rs" readme = "README.md" description = "Low-level Playdate API bindings" diff --git a/api/sys/src/log.rs b/api/sys/src/log.rs index 8c9d9796..20466572 100644 --- a/api/sys/src/log.rs +++ b/api/sys/src/log.rs @@ -1,3 +1,5 @@ +//! `println` function. + use core::ffi::c_char; use alloc::ffi::CString; diff --git a/api/sys/src/sys/allocator.rs b/api/sys/src/sys/allocator.rs index 5f485188..69ad3e0c 100644 --- a/api/sys/src/sys/allocator.rs +++ b/api/sys/src/sys/allocator.rs @@ -1,4 +1,7 @@ #![cfg(not(test))] +//! Global Allocator implementation. Depends on `allocator` feature. + + /* With rust-lang/rust#102318 default_alloc_error_handler has been stabilized, ie. the default error handler is enabled by default. diff --git a/api/sys/src/sys/error/mod.rs b/api/sys/src/sys/error/mod.rs index 6db7ae84..f4124684 100644 --- a/api/sys/src/sys/error/mod.rs +++ b/api/sys/src/sys/error/mod.rs @@ -1,3 +1,5 @@ +//! Typed API errors. + use core::any::Any; use core::convert::Infallible; use core::fmt; diff --git a/api/sys/src/sys/macros.rs b/api/sys/src/sys/macros.rs index 0249ebea..73d63c27 100644 --- a/api/sys/src/sys/macros.rs +++ b/api/sys/src/sys/macros.rs @@ -1,5 +1,8 @@ +//! Helper macros for API access. + + #[macro_export] -/// Print line to stdout, simulator's console or device's output. +/// Print line to stdout, simulator's console or device's output channel. /// /// Woks like [`std::println!`](https://doc.rust-lang.org/std/macro.println.html). macro_rules! println { diff --git a/api/sys/src/sys/panic.rs b/api/sys/src/sys/panic.rs index 98f458dd..b1409d51 100644 --- a/api/sys/src/sys/panic.rs +++ b/api/sys/src/sys/panic.rs @@ -1,5 +1,6 @@ #![cfg(not(test))] #![cfg(feature = "panic-handler")] +//! Global Panic Handler implementation. Depends on `panic-handler` feature. use core::panic::PanicInfo; use core::fmt::Write; diff --git a/api/sys/src/sys/proc.rs b/api/sys/src/sys/proc.rs index ec9109e9..b2df5833 100644 --- a/api/sys/src/sys/proc.rs +++ b/api/sys/src/sys/proc.rs @@ -1,8 +1,11 @@ +//! Process API. Abort and abort with error message. + /// Executes the undefined instruction (UDF) and causes a CPU-level exception. /// See [`core::intrinsics::abort()`] pub fn abort() -> ! { core::intrinsics::abort() } +/// Stops the program execution with custom system-level error. #[track_caller] pub fn error>(text: S) -> ! { if let Some(f) = unsafe { (*(*crate::sys::API).system).error } {