Skip to content

Instantly share code, notes, and snippets.

@vijairaj
Forked from rust-play/playground.rs
Created December 11, 2018 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vijairaj/92fef6fdc3f60dfb6d653775ea846531 to your computer and use it in GitHub Desktop.
Save vijairaj/92fef6fdc3f60dfb6d653775ea846531 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
fn main() {
let cat = '😻'; // U+1F63B // UTF8: F0 9F 98 BB
println!("val {} {:x?}", cat, cat as i32);
let cat_str = String::from("😻");
let cat_bytes = cat_str.as_bytes();
println!("val {} {:x?}", cat_str, cat_bytes);
}
@vijairaj
Copy link
Author

vijairaj commented Dec 11, 2018

cat as i32 = 1f63b
cat_byes = [f0, 9f, 98, bb]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment