diff --git a/.gitignore b/.gitignore index 6e771f8..798ed1f 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,8 @@ target/ # MSVC Windows builds of rustc generate these, which store debugging information *.pdb +Cargo.lock +**/Cargo.lock # RustRover # JetBrains specific template is maintained in a separate JetBrains.gitignore that can # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore diff --git a/Cargo.lock b/Cargo.lock index bf12bd4..6154932 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -270,6 +270,7 @@ version = "0.1.0" dependencies = [ "reqwest", "tokio", + "worldlib", ] [[package]] @@ -1565,6 +1566,10 @@ dependencies = [ "bitflags", ] +[[package]] +name = "worldlib" +version = "0.1.0" + [[package]] name = "write16" version = "1.0.0" diff --git a/Cargo.toml b/Cargo.toml index 5c1f41e..83f6dc5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,3 @@ [workspace] resolver ="2" -members =["crates/hello"] +members =["crates/hello", "crates/worldlib"] diff --git a/crates/hello/Cargo.toml b/crates/hello/Cargo.toml index 795bb13..d4c0dc4 100644 --- a/crates/hello/Cargo.toml +++ b/crates/hello/Cargo.toml @@ -7,3 +7,4 @@ license = "MIT" [dependencies] reqwest = "0.12.15" tokio = { version = "1.44.2", features = ["full"] } +worldlib ={path="../worldlib"} diff --git a/crates/hello/src/main.rs b/crates/hello/src/main.rs index 5e0da26..66d1991 100644 --- a/crates/hello/src/main.rs +++ b/crates/hello/src/main.rs @@ -6,6 +6,7 @@ async fn main() -> Result<(), Box> { println!("body:{}", body); println!("hello world"); + worldlib::print_sth("this is from hello".to_string()); Ok(()) } #[allow(dead_code)] diff --git a/crates/worldlib/Cargo.toml b/crates/worldlib/Cargo.toml new file mode 100644 index 0000000..b06e819 --- /dev/null +++ b/crates/worldlib/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "worldlib" +version = "0.1.0" +edition = "2024" +license = "MIT" +[dependencies] diff --git a/crates/worldlib/src/lib.rs b/crates/worldlib/src/lib.rs new file mode 100644 index 0000000..b2542d7 --- /dev/null +++ b/crates/worldlib/src/lib.rs @@ -0,0 +1,3 @@ +pub fn print_sth(s: String) { + println!("{}", s); +}