mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-26 00:00:03 +03:00
very small solution update
This commit is contained in:
parent
55cc8584bd
commit
938b90e5f2
|
@ -2,7 +2,7 @@
|
||||||
// Execute `rustlings hint generics3` or use the `hint` watch subcommand for a hint.
|
// Execute `rustlings hint generics3` or use the `hint` watch subcommand for a hint.
|
||||||
|
|
||||||
// Here we add generic in function declaration so function can work with different types
|
// Here we add generic in function declaration so function can work with different types
|
||||||
fn stringify<T>(list: &Vec<T>) -> String
|
fn stringify<T>(list: &[T]) -> String
|
||||||
where
|
where
|
||||||
T: ToString // here we also specify that T needs to implement ToString trait so we can use .to_string() on the vetor elements
|
T: ToString // here we also specify that T needs to implement ToString trait so we can use .to_string() on the vetor elements
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue