| Crates.io | saytify |
| lib.rs | saytify |
| version | 0.3.0 |
| created_at | 2025-12-25 03:52:29.777774+00 |
| updated_at | 2025-12-25 04:31:19.787884+00 |
| description | A simple library for greeting and farewell messages |
| homepage | https://github.com/yourusername/greetify |
| repository | https://github.com/yourusername/greetify |
| max_upload_size | |
| id | 2004137 |
| size | 5,566 |
A simple Rust library for greeting and farewell messages with automatic whitespace trimming.
say_hi() and say_goodbye()Add this to your Cargo.toml:
[dependencies]
saytify = "0.1.0"
use saytify::{say_hi, say_goodbye};
fn main() {
// Basic usage
println!("{}", say_hi("World")); // "Hello, World!"
println!("{}", say_goodbye("Alice")); // "Goodbye, Alice!"
// With automatic whitespace trimming
println!("{}", say_hi(" Bob ")); // "Hello, Bob!"
println!("{}", say_goodbye(" ")); // "Goodbye, !"
// Unicode support
println!("{}", say_hi("José")); // "Hello, José!"
}
say_hi(name: &str) -> StringCreates a greeting message with the provided name.
Parameters:
name - The name to include in the greeting (automatically trimmed)Returns:
say_goodbye(name: &str) -> StringCreates a farewell message with the provided name.
Parameters:
name - The name to include in the farewell (automatically trimmed)Returns:
use saytify::{say_hi, say_goodbye};
// Normal usage
assert_eq!(say_hi("World"), "Hello, World!");
assert_eq!(say_goodbye("Alice"), "Goodbye, Alice!");
// Whitespace handling
assert_eq!(say_hi(" Bob "), "Hello, Bob!");
assert_eq!(say_goodbye(" "), "Goodbye, !");
// Special characters
assert_eq!(say_hi("Alice&Bob"), "Hello, Alice&Bob!");
assert_eq!(say_goodbye("José"), "Goodbye, José!");
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
say_hi() and say_goodbye() functions