Syntactic Fructose
Syntactic Fructose

Reputation: 20084

use namespace instead of folder name

Say I have a project:

foo-bar
  | - lib.rs
  | - ....

But I don't want the namespace foo-bar, I only want bar. Is there anyway to specify this in lib.rs? The obvious solution would be to rename foo-bar to bar, but I can't do that in this case.

Upvotes: 2

Views: 490

Answers (1)

starblue
starblue

Reputation: 56782

You can specify the name of the library in Cargo.toml, see the Cargo documentation.

[lib]
# The name of a target is the name of the library that will be generated. This
# is defaulted to the name of the package or project.
name = "foo"

Upvotes: 6

Related Questions