Code Monkey home page Code Monkey logo

mice's Introduction

Archived

mice has been merged into the project I wrote it for: mbot. I intend to publish further versions, if any, under the AGPLv3+.

docs.rs

mice, messing with dice

This is a simple crate for evaluating dice expressions. It will receive features as I desire, or as are contributed if I happen to be so lucky.

Without further ado, here's some usage:

use mice::roll;

println!("{}", roll("2d6 + 3")?);

println!("{}", roll("2d6 + 3")?.total());

let result = roll("2d6 + 3")?;
println!("{}\n{}", result, result.total());

The parser accepts an arbitrary number of terms in a dice expression.

use mice::roll;
println!("{}", roll("9d8 + 4d2 - 5 - 8d7")?);

Panicking from this crate is considered a serious bug. Please submit an Issue on this project's GitHub repo if it manages to do that, and please describe the usage that it panicked from.

There is one known unavoidable panic that affects this crate. Out of memory. If there isn't enough memory for an allocation, mice will panic. I hope you understand.

To avoid this fate when exposing mice to potentially untrusted users, there exists the util::roll_capped function. If more control is required, use expose::tuple_vec in combination with the builder::RollBuilder::with_tuples method. Both of these things are reexported by the prelude module.

mice's People

Contributors

monadic-cat avatar

Watchers

James Cloos avatar Pat Burroughs avatar

mice's Issues

Dumb build failures on Travis CI

Travis CI builds have become perpetually unreliable- failing on the beta release channel
repeatedly by timing out from not running any commands.

I should probably set up my own CI server.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.