[−][src]Function phpify::array::array_shift
pub fn array_shift<T>(array: &mut Vec<T>) -> Option<T>
Shift an element off the beginning of vector
Description
array_shift() shifts the first value of the vector off and returns it, shortening the vector by one element and moving everything down.
Examples
Example #1 array_shift() example
use phpify::array::array_shift; let mut stack = vec!["orange", "banana", "apple", "raspberry"]; let fruit = array_shift(&mut stack).unwrap(); assert_eq!(stack, vec!["banana", "apple", "raspberry"]); assert_eq!(fruit, "orange");