New to Rust: Hangman game I decided to try my hand at a Hangman game to familiarize myself a bit with the language.
use std::io::{stdin, stdout, Write};

fn main() {
    let stdin = stdin();
    let mut stdout = stdout();

    let to_guess = String::from(&quot;BENEDICT&quot;);

    let mut letters: u128 = 0;

    loop {
        // Replace unguessed letters of to_guess by underscores
        let current = to_guess.chars().map(|x| {
            if x &lt;= 127 as char &amp;&amp; letters &amp; (1 &lt;&lt; x as u8) &gt; 0 {
                x
            } else {
                '_'
            }
        });
        // Add spaces between letters
        let current = current
            .map(|x| x.to_string() + &amp;' '.to_string())
            .collect::&lt;Vec&lt;String&gt;&gt;()
            .join(&quot; &quot;);

        println!(&quot;Current word: {}&quot;, current.trim_end());

        if !current.contains('_') {
            println!(&quot;Congratulations!&quot;);
            break;
        }

        print!(&quot;Enter new letter: &quot;);
        stdout.flush().unwrap();

        let mut letter = String::new();
        stdin.read_line(&amp;mut letter).expect(&quot;Invalid letter&quot;);

        if letter.trim().len() != 1 {
            println!(&quot;Use only one ASCII letter&quot;);
            continue;
        }

        let letter = letter.to_uppercase().chars().next().unwrap();

        letters |= 1 &lt;&lt; letter as u8
    }
}

The to_guess word is hardcoded, and there is an unlimited number of guesses.
To store letters already guessed, I use an u128 and flag the corresponding bit. It should be ok since all ASCII letters are represented by u8 &lt; 128.
Can you help me review the code, are there &quot;Rust&quot; things I missed?
Welcome to Rust.  Here's some suggestions to get you started:
Creating idiomatic use declarations
It is not common in Rust to bring a function into scope directly via a use declaration.  Instead, io::stdin and io::stdout are preferred.  See the section Creating Idiomatic use Paths in the book for more information.
Using structs to self-document code
You included this sentence in your explanation of the code:

To store letters already guessed, I use an u128 and flag the
corresponding bit. It should be ok since all ASCII letters are
represented by u8 &lt; 128.

It is preferable to include this information in the code itself.  In this case, we can introduce a struct:
#[derive(Clone, Copy, Debug, Default)]
struct AsciiSet {
    flag: u128,
}

impl AsciiSet {
    fn new() -&gt; Self {
        Self { flag: 0 }
    }

    fn push(&amp;mut self, letter: u8) {
        self.flag |= (1 &lt;&lt; letter);
    }

    fn contains(&amp;self, letter: u8) -&gt; bool {
        (self.flag &amp; (1 &lt;&lt; letter)) != 0
    }
}

and modify the code accordingly:
let mut letters = AsciiSet::new();

loop {
    // ...
    if letters.contains(letter) { /* ... /* }

    // ...
    letters.push(letter);
}

Checking for ASCII
letter as u8 truncates the character if !letter.is_ascii().  Check for this case and prompt the user accordingly.