-
-
Save cgwalters/3f32fe21fc411b24d10a6faff61bf7fe to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
This file contains 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 f<T: AsRef<str>>(args: &[T]) | |
{ | |
let bargv = &["foo", "bar"]; | |
let nargv : Vec<&str> = bargv.iter().map(|&v|v).chain(args.iter().map(AsRef::as_ref)).collect(); | |
println!("{:?}", nargv); | |
} | |
fn main() { | |
let args : Vec<String> = std::env::args().collect(); | |
f(&args); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment