Man, I'm already not having fun. I'm going to have to specify the type of everything? I can't just say, "type is whatever the return type of that thing is"?
It will figure out the type if it can, but .collect can output many different types. If you want to tell it to collect to a vec for example you can just to .collect::<Vec<_>>();
@brainblasted It's not the shortest way, but I think this way looks nicer. The other way is to give the variable a type like this `let args: Vec<_> = ...` which ls a few chars shorter. Also, this article may be helpful techblog.tonsser.com/posts/wha….
@jalcine @sigma @brainblasted Hehe, I don't know yet what this means. Serialize? I want strings. The strings I type at the command line. Whitespace-separated. As sent by the OS. Why do I need to serialize?
@jalcine @sigmacollect() is a generic function on iterators, and iterators are generic. While the Args iterator on Strings, my understanding is that you can use collect() to collect a vector of anything you could convert a string to.
Chris 🌱
in reply to JordiGH • • •cargo help
andcargo --list
will show you commands that are available to you. That's easier that guessing.JordiGH
in reply to Chris 🌱 • • •JordiGH
in reply to JordiGH • • •Whaaaaat, no type deduction?
Man, I'm already not having fun. I'm going to have to specify the type of everything? I can't just say, "type is whatever the return type of that thing is"?
Sigma
in reply to JordiGH • • •Chris 🌱
in reply to Sigma • • •JordiGH
in reply to Chris 🌱 • • •Sigma
in reply to JordiGH • • •What is Rust's turbofish? - Tonsser Tech Blog
techblog.tonsser.comJordiGH
in reply to Sigma • • •✌🏿✍🏿
in reply to JordiGH • • •JordiGH
in reply to ✌🏿✍🏿 • • •Chris 🌱
in reply to JordiGH • • •collect()
is a generic function on iterators, and iterators are generic. While theArgs
iterator on Strings, my understanding is that you can usecollect()
to collect a vector of anything you could convert a string to.