diff options
author | Martin Fischer <martin@push-f.com> | 2021-11-26 11:20:10 +0100 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2021-11-26 11:45:54 +0100 |
commit | 41e1fdff88f55cac1d61b968d0baaed4a48009e7 (patch) | |
tree | d8b30ce306006a026fa209afacf7426ecade6235 /README.md | |
parent | 774864c85efdcacec141ca803dbd8364b5126080 (diff) |
doc: use more educative example for #[convert]
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -180,7 +180,7 @@ with a dynamized supertrait, you have to tell dynamize about it with the ```rust ignore #[dynamize::dynamize] trait Client { - type Error: Into<SuperError>; + type Error: std::error::Error; fn get(&self, url: String) -> Result<Vec<u8>, Self::Error>; } @@ -188,7 +188,7 @@ trait Client { #[dynamize::dynamize] #[dynamized(Client)] trait ClientWithCache: Client { - type Error: Into<SuperError>; + type Error: std::error::Error; fn get_with_cache<C: Cache>( &self, @@ -208,7 +208,7 @@ second trait to: ```rust ignore #[dynamize::dynamize] #[dynamized(Client)] -#[convert = |x: <Self as Client>::Error| -> SuperError {x.into()}] +#[convert = |x: <Self as Client>::Error| -> Box<dyn std::error::Error + '_> {Box::new(x) as _}] trait ClientWithCache: Client { fn get_with_cache<C: Cache>( &self, |