Create a library package in the current directory.
Section: Create projects
Initialize as library
bash
bash
cargo init --libExplanation
Creates `Cargo.toml` and a `src/lib.rs` starter file.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Create projects
Initialize Cargo in an existing directory
Create a manifest in the current project folder.
Locate the manifest
Print the path to the Cargo.toml file Cargo will use.