Back to articles
Rust Learning Log: Glob Imports, Library Crates, Multiple Binaries

Rust Learning Log: Glob Imports, Library Crates, Multiple Binaries

via Dev.toAjaye Favour

Today I learned about the glob operator, creating a library crate, and multiple binary crates The Glob Operator: The glob operator (*) lets you import everything from a module at once. At first, it felt strong. Almost too powerful. Up until now, Rust has been teaching me to be explicit, to name exactly what I'm bringing into scope. The glob operator relaxes that slightly. That contrast made me think. Rust gives you convenience, but it also gives you responsibility. Even as a learner, I can see how using a glob import might make code shorter but potentially less clear. It made me more aware of how imports shape readability. Creating a Library Crate: Learning how to create a library crate changed how I view Rust projects. Before this, everything I built felt like "a program." Now I see that Rust encourages you to build reusable logic, code meant to be consumed by other parts of the project or even other projects. A library crate feels like saying: this code is meant to be depended on. Th

Continue reading on Dev.to

Opens in a new tab

Read Full Article
4 views

Related Articles