SHARE
TWEET

Untitled

a guest Sep 11th, 2019 99 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fn main() {
  2.     let mut bytes = Vec::new();
  3.     for i in u8::min_value()..u8::max_value() {
  4.         bytes.push(i);
  5.     }
  6.    
  7.     while let Err(error) = std::str::from_utf8(&bytes) {
  8.         bytes.remove(error.valid_up_to());
  9.     }
  10.    
  11.     println!("Result: \"{}\"", std::str::from_utf8(&bytes).unwrap());
  12. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top