| Crates.io | stitcher |
| lib.rs | stitcher |
| version | 0.2.1 |
| created_at | 2025-04-19 21:15:45.843422+00 |
| updated_at | 2025-04-19 23:51:30.123862+00 |
| description | stitcher provides an ergonomic syntax for declaring deeply nested Rust data structures inline — useful for tests and fixtures where writing raw constructors would be noisy or tedious. |
| homepage | https://crates.io/crates/stitcher |
| repository | https://github.com/jameslkingsley/stitcher |
| max_upload_size | |
| id | 1641159 |
| size | 24,301 |
stitcher provides an ergonomic syntax for declaring deeply nested Rust data structures inline — useful for tests and fixtures where writing raw constructors would be noisy or tedious.
cargo add --dev stitcher
$ syntaxuse stitcher::stitch;
use serde::{Serialize, Deserialize};
let timezone = "Europe/London";
let scenario = stitch!(Scenario {
schedules: [
{
name: "Morning Yoga",
location: {
name: "Studio 1",
tz: $timezone,
}
},
{
name: "Evening Spin",
location: schedules[0].location,
}
]
});
#[derive(Debug, Default, Serialize, Deserialize)]
struct Location {
name: String,
tz: String,
}
#[derive(Debug, Default, Serialize, Deserialize)]
struct Schedule {
name: String,
location: Location,
}
#[derive(Debug, Default, Serialize, Deserialize)]
struct Scenario {
schedules: Vec<Schedule>,
}