Advertisement
Guest User

Untitled

a guest
Sep 11th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement