Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::str;
- fn main() {
- {
- let b = vec![240, 159, 146, 150];
- let x = unsafe { str::from_utf8_unchecked(&b) };
- assert_eq!("💖", x);
- }
- {
- let b = vec![240, 159, 146];
- let x = unsafe { str::from_utf8_unchecked(&b) };
- println!("{}", x);
- }
- }
Add Comment
Please, Sign In to add comment