Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ability to use --bin and --lib together with cargo new and init #10595

Open
skewballfox opened this issue Apr 24, 2022 · 2 comments
Open
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-init Command-new

Comments

@skewballfox
Copy link

Problem

currently, cargo init some_project --lib --bin provides the following output:

error: can't specify both lib and binary outputs

Proposed Solution

have a third built in package template that takes a library-first approach

Notes

It seems there is a use-case for projects that are both a library and a binary. clone and compile: its a binary. add to your cargo manifest: it's a library. It also seems there is a right and wrong way to do it.

I think it would be useful to have a package template for library-first applications

@skewballfox skewballfox added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Apr 24, 2022
@anhaabaete
Copy link

For a complete solution, as far better.
Cargo new could have a custom template. From a ~/.cargo/tamplates/my_custom/src/mais.rs
Example:
cargo new --template my_custom

@weihanglo
Copy link
Member

For templating, see #5151

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-init Command-new
Projects
None yet
Development

No branches or pull requests

3 participants