Skip to main content

array_push

Function array_push 

Source
pub fn array_push<T>(array: &mut Vec<T>, value: T)
Expand description

Push one or more elements onto the end of vector

§Description

array_push() treats vector as a stack, and pushes the passed variable onto the end of vector. The length of vector increases by one.

§Examples

Example #1 array_push() example

use phpify::array::array_push;

let mut stack = vec!["orange", "banana"];
array_push(&mut stack, "apple");

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