Guest User

Untitled

a guest
Nov 17th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. use std::str;
  2.  
  3. fn main() {
  4. {
  5. let b = vec![240, 159, 146, 150];
  6. let x = unsafe { str::from_utf8_unchecked(&b) };
  7. assert_eq!("💖", x);
  8. }
  9.  
  10. {
  11. let b = vec![240, 159, 146];
  12. let x = unsafe { str::from_utf8_unchecked(&b) };
  13. println!("{}", x);
  14. }
  15. }
Add Comment
Please, Sign In to add comment