From bff13caf9ee2f806dd32c5d77f0e4ac9eb28c7f5 Mon Sep 17 00:00:00 2001 From: mo khan Date: Fri, 20 Jun 2025 11:41:31 -0600 Subject: docs: add a project README --- README.md | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..6645b64 --- /dev/null +++ b/README.md @@ -0,0 +1,57 @@ +# please + +A simple Rust library providing convenient builder pattern utilities. + +## Overview + +`please` offers two main functions for creating and initializing objects: + +- `build()` - Creates a new instance using the type's `Default` implementation +- `build_with()` - Creates a new instance and applies a custom initializer function + +## Usage + +Add this to your `Cargo.toml`: + +```toml +[dependencies] +please = "0.1.0" +``` + +### Examples + +Basic usage with `build()`: + +```rust +use please::build; + +#[derive(Default)] +struct Person { + name: String, + age: i32, +} + +let person = build::(); +// Creates Person { name: "", age: 0 } +``` + +Custom initialization with `build_with()`: + +```rust +use please::build_with; + +let person = build_with(|p: &mut Person| { + p.name = String::from("Alice"); + p.age = 30; +}); +// Creates Person { name: "Alice", age: 30 } +``` + +## Requirements + +- Rust 2024 edition +- Types must implement `Default` trait + +## License + +MIT \ No newline at end of file -- cgit v1.2.3