ratamath 0.1.0

A simple math training TUI game built with Ratatui( not final version)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::{
    io::{Write, stdin, stdout},
    str::FromStr,
};

pub fn input_<T>(msg: &str) -> T
where
    T: FromStr,
    <T as FromStr>::Err: std::fmt::Debug,
{
    print!("{}", msg);
    stdout().flush().unwrap();
    let mut s = String::new();
    stdin().read_line(&mut s).unwrap();
    let final_result: T = s.trim().parse().unwrap();
    final_result
}