⚠️ Pre-release: version 0.0.2 is experimental. APIs and crate layout may change without backward compatibility guarantees.
accepts is the minimal core for composing synchronous and asynchronous
"acceptor" pipelines. It exposes only the traits and blanket implementations you
need to wire values through a chain of acceptors. There are no bundled acceptors;
those live in sibling crates.
For design details, see ARCHITECTURE.md in this repo.
This crate only defines the core traits. See ARCHITECTURE.md for series lineup and naming guidelines.
[dependencies]
accepts = "0.0.2"- Default features include
alloc. Disable defaults for a core-onlyno_stdbuild:accepts = { version = "0.0.2", default-features = false }. Re-enableallocif you still wantBox/Arcand dyn-async support.
use accepts::Accepts;
struct Logger;
impl Accepts<&str> for Logger {
fn accept(&self, value: &str) {
println!("[log] {value}");
}
}
struct Metrics;
impl Accepts<&str> for Metrics {
fn accept(&self, value: &str) {
println!("[metrics] saw {value}");
}
}
// Tuples and collections forward to each element; `&str` is `Copy`, so cloning
// to fan out is cheap.
let pipeline = (Logger, Metrics);
pipeline.accept("ping");Async pipelines follow the same shape with AsyncAccepts; enable alloc if you
want to box the returned futures via DynAsyncAccepts.
| accepts | notes |
|---|---|
| 0.0.2 | current pre-release |
See ARCHITECTURE.md for design notes, feature flags, and blanket impl coverage.
| Feature | Default | Description |
|---|---|---|
alloc |
✅ | Adds heap-backed blanket impls (Box/Rc/Arc), Vec/VecDeque impls, and auto-implements DynAsyncAccepts. |
Accepts,AsyncAccepts,DynAsyncAcceptsat the crate root.implementations/core/*forno_stdblanket impls (tuples,Option,Result, slices/arrays, pointer types).implementations/alloc/*for heap-backed impls (Vec,VecDeque, pointers).
This project is dual-licensed under MIT and Apache-2.0. You may use it under either license.
Bug reports, feature requests, and pull requests are always welcome.
I'm still new to GitHub and not very confident in English. For now, I'm doing my best with the help of ChatGPT, so I might misunderstand something. Thanks for your understanding!