rpg-dice-rust

Crates.iorpg-dice-rust
lib.rsrpg-dice-rust
version1.1.0
sourcesrc
created_at2020-10-18 06:59:59.962342
updated_at2020-10-18 06:59:59.962342
descriptionAn RPG dice rolling library and command line app.
homepage
repositoryhttps://github.com/dgunay/rpg-dice-rust
max_upload_size
id301896
size26,234
Devin Gunay (dgunay)

documentation

README

Rust

RPG Dice Rust

I used a command line dice roller as a way of learning how Perl's package ecosystem worked, so I figured I'd do it again as a modest Rust project.

It uses Regex, SmallRng, and Evalexpr to do dice rolling. Due to the use of Evalexpr, it might also support more than I had intended initially (just integer math).

Testing

Run tests:

cargo test

Fuzzing

Uses cargo fuzz. Requires a nightly compiler.

See fuzzing targets:

cargo fuzz list

Run a fuzzing target:

rustup run nightly cargo fuzz run <target>

Building for Android/Termux

You can cross-compile the project to run on Termux. Download the Android Native Development Kit (NDK) and the appropriate Rust target, and run the command like this:

$ env CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=/path/to/ndk/android-ndk-r21/toolc
hains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android29-clang cargo build --target aarch64-linux-android

That example is for my phone (Galaxy Note 8), you may need a different Clang toolchain and target depending on your phone's CPU architecture.

Commit count: 40

cargo fmt