Skip to content

Commit

Permalink
fix panic, update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
boozook committed Jul 12, 2024
1 parent 1fc9b65 commit 549fc34
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "playdate-sys"
version = "0.4.2"
version = "0.4.3"
build = "src/build.rs"
readme = "README.md"
description = "Low-level Playdate API bindings"
Expand Down
3 changes: 3 additions & 0 deletions api/sys/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ _I've experimented enough with wrapping the entire API with results at every ste

## Prerequisites

<abbr title="Minimal Nightly Rust Version">MNRV</abbr> is [`1.81.0` from 2024-06-29][rust-toolchain.toml]

1. Rust __nightly__ toolchain (rustup is optional)
1. [Playdate SDK][sdk]
- Ensure that env var `PLAYDATE_SDK_PATH` points to the SDK root
Expand All @@ -31,6 +33,7 @@ _I've experimented enough with wrapping the entire API with results at every ste

[sdk]: https://play.date/dev/#cardSDK
[doc-prerequisites]: https://sdk.play.date/Inside%20Playdate%20with%20C.html#_prerequisites
[rust-toolchain.toml]: https://github.com/boozook/playdate/blob/main/rust-toolchain.toml#L2


## Usage
Expand Down
19 changes: 1 addition & 18 deletions api/sys/src/sys/panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,6 @@ use super::proc::error;
#[panic_handler]
fn panic(panic_info: &PanicInfo) -> ! {
let mut output = ArrayString::<1024>::new();
let payload = if let Some(payload) = panic_info.payload().downcast_ref::<&str>() {
payload
} else {
""
};

let location = panic_info.location();
let (module, line) = if let Some(location) = location {
(location.file(), location.line())
} else {
("", 0)
};

let _ = if let Some(message) = panic_info.message() {
write!(output, "PANIC: [{module}@{line}] \"{message}\" {payload}\0")
} else {
write!(output, "PANIC: [{module}@{line}] {payload}\0")
};
let _ = write!(output, "{panic_info}\0");
error(output.as_str());
}

0 comments on commit 549fc34

Please sign in to comment.