xod 1.0.1

A tiny REPL for bitwise arithmetic and expression evaluation.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
pub fn print_num(title: &'static str, num: usize) {
    println!("{title}");
    println!("Base 10:               {num}");
    println!("Base 2 (binary):       {num:b}");
    println!("Base 8 (octal):        {num:o}");
    println!("Base 16 (hexadecimal): {num:x}");
    if num != 0 {
        println!("Boolean (bit):         1");
    } else {
        println!("Boolean (bit):         0");
    }
    println!();
}

pub fn string_to_static_str(s: String) -> &'static str {
    Box::leak(s.into_boxed_str())
}