Last active
March 2, 2019 17:33
-
-
Save 17cupsofcoffee/0056a7645e31796673eb4e6e4fd944ce to your computer and use it in GitHub Desktop.
main and lib in the same crate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn in_bar() { | |
println!("bar"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "example" | |
version = "0.1.0" | |
authors = ["Joe Clay <[email protected]>"] | |
edition = "2018" | |
[dependencies] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use crate::bar::in_bar; | |
pub fn in_foo() { | |
in_bar(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub mod bar; | |
pub mod foo; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use example::bar::in_bar; | |
use example::foo::in_foo; | |
fn main() { | |
in_foo(); | |
in_bar(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment