Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cargo: invalid character `.` in crate name

Assume I want my executable to be named "index.cgi" (or any other name which is not a correct Rust crate name) and to be built with Cargo.
Is there any way in Cargo to specify a name of output executable, or rename an executable in a post-build step? The documentation of Cargo is very scarce and I haven't found anything there. (A brief look at the sources didn't helped much too.)

like image 371
user2665887 Avatar asked Sep 30 '22 01:09

user2665887


1 Answers

The crate name and executable names must both be valid Rust identifiers.


You can set the name of an output executable (see 'Configuring a target' in the documentation for Cargo's manifest format), but it also has to be a valid identifier.

[[bin]]
name = "index.cgi"
path = "src/main.rs"
like image 142
borntyping Avatar answered Oct 18 '22 05:10

borntyping