I am currently building a simple interpreter for this language for practice. The only problem left to overcome is reading a single byte as a character from user input. I have the following code so far, but I need a way to turn the String
that the second lines makes into a u8
or another integer that I can cast:
let input = String::new()
let string = std::io::stdin().read_line(&mut input).ok().expect("Failed to read line");
let bytes = string.chars().nth(0) // Turn this to byte?
The value in bytes should be a u8
which I can cast to a i32
to use elsewhere. Perhaps there is a simpler way to do this, otherwise I will use any solution that works.