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

Folder for executable source in projects combining lib and bin #9

Closed
bvssvni opened this issue Apr 14, 2014 · 2 comments
Closed

Folder for executable source in projects combining lib and bin #9

bvssvni opened this issue Apr 14, 2014 · 2 comments

Comments

@bvssvni
Copy link

bvssvni commented Apr 14, 2014

https://github.com/carlhuda/cargo/blob/master/DESIGN/MANIFEST.md

It says bin/*.rs should contain the source code of the executable.

Normally, a bin/ folder contains the executable and the required files to run.
The content of the bin/ folder is copyable to any other folder on the same machine.
It may be target specific and only work for that machine.

Example:

  1. Cloning repository.
  2. ./configure
  3. make
  4. Copying the content of the bin/ folder.

When I see bin/ I read 'binaries' and believes it will contain the binaries required to run the application.

@bvssvni
Copy link
Author

bvssvni commented Apr 14, 2014

Alternatives:

  1. Change to main/*.rs.
  2. Use the module tree under src/main.rs, library as module tree under src/lib.rs.

The second solution sounds messy, but it allows one to move modules easily from executable source to library. The executable is usually a thin wrapper on top of the library. A positive side effect is that it encourages writing apps as reusable libraries.

Rust-Empty (https://github.com/bvssvni/rust-empty) uses the second alternative at the moment.

I don't have a very strong opinion about how it should be, but I am strongly against using bin/ because it is confusing.

@bvssvni
Copy link
Author

bvssvni commented Apr 14, 2014

Oh, sorry! I thought lib/ and bin/ were under the top directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant