Created
June 10, 2018 12:59
-
-
Save rust-play/d3d16c587a0cc63a56ef8e4fbeb35955 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