Skip to content

Commit

Permalink
Merge pull request #43 from Rusty-Weasel/rewrite/v3
Browse files Browse the repository at this point in the history
-basic setup workspace
  • Loading branch information
Sweattypalms authored Sep 16, 2024
2 parents 6eb0495 + 50ff861 commit 8177bb8
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 15 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
**/target
.idea
.idea
/crates/lib/dummy_lib/Cargo.lock
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 16 additions & 14 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
[package]
name = "ferrumc"
version = "0.1.1"
edition = "2021"
[workspace]
resolver = "2"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
members = [
"crates/bin",
"crates/lib/*",
]
exclude = []

[dependencies]
# Strip debuginfo from the release builds
# Also enable thin LTO for some optimizations
[profile.release]
strip = "debuginfo"
lto = "thin"
opt-level = "z"


[lib]
name = "ferrumc"
path = "src/lib.rs"

[[bin]]
name = "ferrumc"
path = "src/main.rs"
# A little bit of a speedup
[profile.dev]
split-debuginfo = "unpacked"
3 changes: 3 additions & 0 deletions crates/README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Folder:
- bin = lib and bin of ferrumc
- lib = all subfolder = lib crates of other parts
18 changes: 18 additions & 0 deletions crates/bin/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "ferrumc"
version = "0.1.1"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
# Example dummy_lib
dummy_lib = { path = "../lib/dummy_lib" }

[lib]
name = "ferrumc"
path = "src/lib.rs"

[[bin]]
name = "ferrumc"
path = "src/main.rs"
2 changes: 2 additions & 0 deletions crates/bin/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Security
#![forbid(unsafe_code)]
3 changes: 3 additions & 0 deletions src/main.rs → crates/bin/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Security
#![forbid(unsafe_code)]

fn main() {
println!("Hello, world!");
}
6 changes: 6 additions & 0 deletions crates/lib/dummy_lib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[package]
name = "dummy_lib"
version = "0.1.0"
edition = "2021"

[dependencies]
1 change: 1 addition & 0 deletions crates/lib/dummy_lib/README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## Just a dummy as example
17 changes: 17 additions & 0 deletions crates/lib/dummy_lib/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Security
#![forbid(unsafe_code)]

pub fn add(left: u64, right: u64) -> u64 {
left + right
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}
Empty file removed src/lib.rs
Empty file.

0 comments on commit 8177bb8

Please sign in to comment.