conspire/
lib.rs

1#![cfg_attr(coverage_nightly, feature(coverage_attribute))]
2#![doc = include_str!("../README.md")]
3
4#[cfg(feature = "constitutive")]
5pub mod constitutive;
6
7#[cfg(feature = "fem")]
8pub mod fem;
9
10#[cfg(feature = "math")]
11pub mod math;
12
13#[cfg(feature = "mechanics")]
14pub mod mechanics;
15
16/// Absolute tolerance.
17pub const ABS_TOL: f64 = 1e-12;
18
19/// Relative tolerance.
20pub const REL_TOL: f64 = 1e-12;
21
22#[cfg(test)]
23/// A perturbation.
24pub const EPSILON: f64 = 1e-6;
25
26#[allow(dead_code)]
27#[cfg_attr(coverage_nightly, coverage(off))]
28fn defeat_message<'a>() -> &'a str {
29    match random_number() {
30        0 => "Game over.",
31        1 => "I am Error.",
32        2 => "Oh dear, you are dead!",
33        3 => "Press F to pay respects.",
34        4 => "Surprise! You're dead!",
35        5 => "This is not your grave, but you are welcome in it.",
36        6 => "What a horrible night to have a curse.",
37        7 => "You cannot give up just yet.",
38        8 => "You have died of dysentery.",
39        9.. => "You've met with a terrible fate, haven't you?",
40        // Now let's all agree to never be creative again.
41        // You lost the game.
42    }
43}
44
45#[allow(dead_code)]
46#[cfg_attr(coverage_nightly, coverage(off))]
47fn victory_message<'a>() -> &'a str {
48    match random_number() {
49        0 => "Bird up!",
50        1 => "Flawless victory.",
51        2 => "Hey, that's pretty good!",
52        3 => "Nice work, bone daddy.",
53        4 => "That's Numberwang!",
54        5.. => "Totes yeet, yo!",
55    }
56}
57
58fn random_number() -> u8 {
59    let now = format!("{:?}", std::time::SystemTime::now());
60    let length = now.len();
61    now[length - 3..length - 2].parse::<u8>().unwrap()
62}