| Crates.io | ludndev-hello-world |
| lib.rs | ludndev-hello-world |
| version | 0.1.1 |
| created_at | 2023-09-23 16:58:09.944881+00 |
| updated_at | 2023-09-23 21:02:41.228808+00 |
| description | A Rust crate for greeting people. |
| homepage | https://crates.io/crates/ludndev-hello-world |
| repository | https://github.com/ludndev/rustlang-hello-world-lib |
| max_upload_size | |
| id | 981354 |
| size | 4,984 |
This Rust project provides a simple greeting function that greets a person by name or defaults to "Hello World!" if no name is provided.
To use this library in your Rust project, add it as a dependency in your Cargo.toml:
[dependencies]
ludndev-hello-world = "0.1.0"
Then, you can use it in your code:
use ludndev-hello-world::greet;
fn main() {
let name = "John";
let greeting = greet(name);
println!("{}", greeting);
}
greet(name: &str) -> StringThis function takes a name as input and returns a greeting message. If the name is empty, it defaults to "Hello World!".
use ludndev-hello-world::greet;
fn main() {
let name = "Alice";
let greeting = greet(name);
assert_eq!(greeting, "Hello Alice !");
}
This project is licensed under the MIT License - see the LICENSE file for details.
This project was authored by Judicaƫl AHYI.