Created
July 17, 2018 20:32
-
-
Save rust-play/dcc27b2c4f9260c02490ddd2cfb2a34e 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 main() { | |
let some_string = convert(vec!["one", "two", "three"]); | |
println!("{}", some_string); | |
} | |
//Doesn't Work | |
pub fn convert<T>(values: Vec<T>) -> String where T: Into<String> { | |
values.iter() | |
.collect::<Vec<String>>() | |
.join(",") | |
} | |
/* | |
//Works | |
pub fn convert<T>(values: T) -> String where T: Into<String> { | |
values.into() | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment