added workspaces example

This commit is contained in:
gabe 2022-08-10 11:44:20 -05:00
parent eb0612b93b
commit aec66ef7c8
5 changed files with 42 additions and 0 deletions

View file

@ -0,0 +1,6 @@
[workspace]
members = [
"adder",
"add_one",
]

View file

@ -0,0 +1,9 @@
[package]
name = "add_one"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
rand = "0.8.3"

View file

@ -0,0 +1,12 @@
pub fn add_one(x: i32) -> i32 {
x + 1
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn it_works() {
assert_eq!(3, add_one(2))
}
}

View file

@ -0,0 +1,9 @@
[package]
name = "adder"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
add_one = {path = "../add_one"}

View file

@ -0,0 +1,6 @@
use add_one;
fn main() {
let num = 10;
println!("Hello World! {} plus 1 is {}", num, add_one::add_one(num));
}