/
View dependency graph
Depends on
- dh-cargo (dh-sequence-cargo)
- rust-proc-macro2 (librust-proc-macro2-1+default-dev)
- rust-quote (librust-quote-1+default-dev)
- rust-syn (librust-syn-2+default-dev, librust-syn-2+full-dev)
- cargo, debhelper-compat, libstd-rust-dev, rustc
README (full)
Utilities for working with impl Traits in Rust.
trait_variant
trait_variant generates a specialized version of a base trait that uses async fn and/or -> impl Trait.
For example, if you want a Sendable version of your trait, you'd write:
#[trait_variant::make(IntFactory: Send)]
trait LocalIntFactory {
async fn make(&self) -> i32;
fn stream(&self) -> impl Iterator<Item = i32>;
fn call(&self) -> u32;
}
The trait_variant::make would generate an additional trait called IntFactory:
use core::future::Future;
trait IntFactory: Send {
fn make(&self) -> impl Future<Output = i32> + Send;
fn stream(&self) -> impl Iterator<Item = i32> + Send;
fn call(&self) -> u32;
}
Implementers can choose to implement either LocalIntFactory or IntFactory as appropriate.
For more details, see the docs for trait_variant::make.
License and usage notes
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
| dir | debian/ |
| dir | examples/ |
| dir | src/ |
| file | .cargo_vcs_info.json |
| file | Cargo.lock |
| file | Cargo.toml |
| file | Cargo.toml.orig |
| file | LICENSE-APACHE |
| file | LICENSE-MIT |
| file | README.md |