Skip to content

Instantly share code, notes, and snippets.

@mitsuhiko
Created September 24, 2017 13:58
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 mitsuhiko/8ee73cb173efe18a49e8598825d89c1e to your computer and use it in GitHub Desktop.
Save mitsuhiko/8ee73cb173efe18a49e8598825d89c1e to your computer and use it in GitHub Desktop.
#[test]
fn test_unsafe_shit() {
let data = vec![0u8; 16];
let byteview = ByteView::from_vec(data);
let mut x = &[][..];
let handle = ByteViewHandle::from_byteview(byteview, |bytes| -> Result<_, ()> {
x = bytes;
Ok(bytes)
}).unwrap();
assert_eq!(x[0], 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment