From 7a867a14d205c933213f4b00dd8e959d18dd8045 Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Tue, 12 Sep 2023 17:01:33 +0200 Subject: [PATCH] workspace setup --- Cargo.lock | 11 +++++++++++ Cargo.toml | 19 +++++++++++++++---- README.md | 9 +++++++++ members/c-bindings/Cargo.toml | 8 ++++++++ members/c-bindings/src/main.rs | 3 +++ src/main.rs | 10 +++++++++- 6 files changed, 55 insertions(+), 5 deletions(-) create mode 100644 Cargo.lock create mode 100644 members/c-bindings/Cargo.toml create mode 100644 members/c-bindings/src/main.rs diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..23569ca --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,11 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "c-bindings" +version = "0.1.0" + +[[package]] +name = "rs-basic" +version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index be29f5c..050f7ad 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,19 @@ +[workspace] +publish = false +members = [ + ".", + "members/c-bindings" +] +default-members = [ + ".", + "members/c-bindings" +] + [package] name = "rs-basic" version = "0.1.0" edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] +authors = ["Christoph J. Scherr "] +publish = false +autobins = true +default-run = "rs-basic" diff --git a/README.md b/README.md index e69de29..e5e5fcd 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,9 @@ +# Rust basics + +This repository aims to contain basics for the rust language. + +## Structure + +- [`modules`] contains complete small `cargo` projects +- [`src/bin`] contains binaries that are too small to justify a complete + directory. diff --git a/members/c-bindings/Cargo.toml b/members/c-bindings/Cargo.toml new file mode 100644 index 0000000..f10ea2e --- /dev/null +++ b/members/c-bindings/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "c-bindings" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/members/c-bindings/src/main.rs b/members/c-bindings/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/members/c-bindings/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} diff --git a/src/main.rs b/src/main.rs index e7a11a9..2b7abb0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,11 @@ fn main() { - println!("Hello, world!"); + println!( +"This is the default executable! It does not do much, use another executable. + +Select your target like this: +`cargo run --bin $TARGET` + +To see a list of all runnable binaries, you can use the following command. +`cargo run --bin` +"); }