Function array_pop

Source
pub fn array_pop<T>(array: &mut Vec<T>) -> Option<T>
Expand description

Pop the element off the end of vector

§Description

array_pop() pops and returns the value of the last element of vector, shortening the vector by one element.

§Examples

Example #1 array_pop() example

use phpify::array::array_pop;

let mut stack = vec!["orange", "banana", "apple", "raspberry"];
let fruit = array_pop(&mut stack).unwrap();

assert_eq!(stack, vec!["orange", "banana", "apple"]);
assert_eq!(fruit, "raspberry");