Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

encode_a_msg.rs

#![allow(unused)]
fn main() {
// This was a cool example from https://doc.rust-lang.org/std/iter/trait.Iterator.html
let chars = ['g', 'd', 'k', 'k', 'n'];

let hello: String = chars.into_iter()
    .map(|x| x as u8)
    .map(|x| (x + 1) as char)
    .collect();

assert_eq!("hello", hello);
}