aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2021-11-21 21:36:15 +0100
committerMartin Fischer <martin@push-f.com>2021-11-21 21:36:28 +0100
commit8345637cb9f21fdcfcaa13a48329137e5527a0d3 (patch)
treef9b2c4c74d301223a992015dcc4cd3b329fb4cd3 /README.md
parent29d0acb48a03a08eff63d0c40c2e6961f250cb89 (diff)
auto-box all trait bounds, bump version to 0.3.2v0.3.2
Diffstat (limited to 'README.md')
-rw-r--r--README.md11
1 files changed, 6 insertions, 5 deletions
diff --git a/README.md b/README.md
index 4a383fe..573c30b 100644
--- a/README.md
+++ b/README.md
@@ -72,12 +72,13 @@ automatically also implements `DynClient`!
## How does this actually work?
The destination type of an associated type is
-determined by looking at its first trait bound:
+determined by looking at its trait bounds:
-* `Into<T>` is mapped to `T`
+* if the first trait bound is `Into<T>` the destination type is `T`
-* `SomeTrait` is mapped to `Box<dyn SomeTrait>`
- (for this `SomeTrait` of course needs to be object-safe)
+* otherwise the destination type is the boxed trait object of all trait bounds
+ e.g. `Error + Send` becomes `Box<dyn Error + Send>`
+ (for this the first trait bound needs to be object-safe)
Dynamize can convert associated types in:
@@ -132,7 +133,7 @@ async functions in traits, you'll have to additionally use another library like
#[blanket_impl_attr(async_trait)]
#[async_trait]
trait Client: Sync {
- type Error: std::error::Error;
+ type Error: std::error::Error + Send;
async fn get(&self, url: String) -> Result<Vec<u8>, Self::Error>;
}