aboutsummaryrefslogtreecommitdiff
path: root/tests/tests.rs
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2021-11-25 10:30:54 +0100
committerMartin Fischer <martin@push-f.com>2021-11-26 11:45:53 +0100
commit7489a3c2246e7ea2483446dd2ed3fdbfaf462c1a (patch)
treefc2670f56f7cc16567eb10d88f9439abb9098298 /tests/tests.rs
parent43950edc4f26a07055fb917fa8bbb262276e2a08 (diff)
introduce #[convert] attribute
Diffstat (limited to 'tests/tests.rs')
-rw-r--r--tests/tests.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/tests.rs b/tests/tests.rs
index b75c605..11bf10d 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -297,3 +297,22 @@ trait OneTrait: SomeTrait {
fn test(&self) -> Self::X;
}
+
+struct SuperError;
+trait Cache {}
+#[dynamize::dynamize]
+trait Client {
+ type Error: Into<SuperError>;
+
+ fn get(&self, url: String) -> Result<Vec<u8>, Self::Error>;
+}
+#[dynamize::dynamize]
+#[dynamized(Client)]
+#[convert = |x: <Self as Client>::Error| -> SuperError {x.into()}]
+trait ClientWithCache: Client {
+ fn get_with_cache<C: Cache>(
+ &self,
+ url: String,
+ cache: C,
+ ) -> Result<Vec<u8>, <Self as Client>::Error>;
+}