Created
March 25, 2013 16:36
-
-
Save pnkfelix/5238517 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fn vec_peek<T>(v: &'r [T]) -> Option< (&'r T, &'r [T]) > { | |
| if v.len() == 0 { | |
| None | |
| } else { | |
| let head = &v[0]; | |
| let tail = v.view(1, v.len()); | |
| Some( (head, tail) ) | |
| } | |
| } |
Author
pnkfelix
commented
Mar 25, 2013
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment