Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why is a "use" needed for env::args() but not Vec::new()?

For env::args() I am having to explicitly include the env module by

use std::env;

But I am able to use Vec::new() without the use std::vec statement, though both are from the standard library.

Is there a subset of standard library modules that are made available by default for all programs?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Yes, everything in the Rust prelude (including std::vec::Vec) is available by default.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading