diff --git a/README.md b/README.md index 6c98cf1..fa257b8 100644 --- a/README.md +++ b/README.md @@ -143,11 +143,10 @@ trait Visitor { - ✓ Support for traits with generic arguments. - ✓ `#[derive(Ref)]` - ✓ `#[derive(Mut)]` -- ✓ `#[derive(Box)]` +- ✓ `#[derive(Box)]` for both sized and unsized types. - ✓ `#[derive(Rc)]` - ✓ `#[derive(Arc)]` -- ✗ Update `Box` derive to allow unsized types if possible. -- ✗ `#[derive(Cow)]` +- ✓ `#[derive(Cow)]` ## 🤝 Credits diff --git a/tests/derive_arc/successes/async_assoc_function.rs b/tests/derive_arc/successes/async_assoc_function.rs new file mode 100644 index 0000000..336110a --- /dev/null +++ b/tests/derive_arc/successes/async_assoc_function.rs @@ -0,0 +1,20 @@ +use std::sync::Arc; + +use impls::impls; + +#[blanket::blanket(derive(Arc))] +trait Foo { + async fn bar(); +} + +#[derive(Default)] +struct Baz; + +impl Foo for Baz { + async fn bar() {} +} + +fn main() { + assert!(impls!(Baz: Foo)); + assert!(impls!(Arc: Foo)); +} \ No newline at end of file diff --git a/tests/derive_arc/successes/async_method.rs b/tests/derive_arc/successes/async_method.rs new file mode 100644 index 0000000..33bde28 --- /dev/null +++ b/tests/derive_arc/successes/async_method.rs @@ -0,0 +1,20 @@ +use std::sync::Arc; + +use impls::impls; + +#[blanket::blanket(derive(Arc))] +trait Foo { + async fn bar(&self); +} + +#[derive(Default)] +struct Baz; + +impl Foo for Baz { + async fn bar(&self) {} +} + +fn main() { + assert!(impls!(Baz: Foo)); + assert!(impls!(Arc: Foo)); +} \ No newline at end of file diff --git a/tests/derive_box/successes/async_assoc_function.rs b/tests/derive_box/successes/async_assoc_function.rs new file mode 100644 index 0000000..aeaab17 --- /dev/null +++ b/tests/derive_box/successes/async_assoc_function.rs @@ -0,0 +1,18 @@ +use impls::impls; + +#[blanket::blanket(derive(Box))] +trait Foo { + async fn bar(); +} + +#[derive(Default)] +struct Baz; + +impl Foo for Baz { + async fn bar() {} +} + +fn main() { + assert!(impls!(Baz: Foo)); + assert!(impls!(Box: Foo)); +} \ No newline at end of file diff --git a/tests/derive_box/successes/async_method.rs b/tests/derive_box/successes/async_method.rs new file mode 100644 index 0000000..d08d0d8 --- /dev/null +++ b/tests/derive_box/successes/async_method.rs @@ -0,0 +1,18 @@ +use impls::impls; + +#[blanket::blanket(derive(Box))] +trait Foo { + async fn bar(&self); +} + +#[derive(Default)] +struct Baz; + +impl Foo for Baz { + async fn bar(&self) {} +} + +fn main() { + assert!(impls!(Baz: Foo)); + assert!(impls!(Box: Foo)); +} \ No newline at end of file diff --git a/tests/derive_cow/successes/async_assoc_function.rs b/tests/derive_cow/successes/async_assoc_function.rs new file mode 100644 index 0000000..2316fb9 --- /dev/null +++ b/tests/derive_cow/successes/async_assoc_function.rs @@ -0,0 +1,20 @@ +use std::borrow::Cow; + +use impls::impls; + +#[blanket::blanket(derive(Cow))] +trait Foo { + async fn bar(); +} + +#[derive(Default, Clone)] +struct Baz; + +impl Foo for Baz { + async fn bar() {} +} + +fn main() { + assert!(impls!(Baz: Foo)); + assert!(impls!(Cow: Foo)); +} \ No newline at end of file diff --git a/tests/derive_cow/successes/async_method.rs b/tests/derive_cow/successes/async_method.rs new file mode 100644 index 0000000..92a0010 --- /dev/null +++ b/tests/derive_cow/successes/async_method.rs @@ -0,0 +1,20 @@ +use std::borrow::Cow; + +use impls::impls; + +#[blanket::blanket(derive(Cow))] +trait Foo { + async fn bar(&self); +} + +#[derive(Default, Clone)] +struct Baz; + +impl Foo for Baz { + async fn bar(&self) {} +} + +fn main() { + assert!(impls!(Baz: Foo)); + assert!(impls!(Cow: Foo)); +} \ No newline at end of file diff --git a/tests/derive_rc/successes/async_assoc_function.rs b/tests/derive_rc/successes/async_assoc_function.rs new file mode 100644 index 0000000..b9c9833 --- /dev/null +++ b/tests/derive_rc/successes/async_assoc_function.rs @@ -0,0 +1,20 @@ +use std::rc::Rc; + +use impls::impls; + +#[blanket::blanket(derive(Rc))] +trait Foo { + async fn bar(); +} + +#[derive(Default)] +struct Baz; + +impl Foo for Baz { + async fn bar() {} +} + +fn main() { + assert!(impls!(Baz: Foo)); + assert!(impls!(Rc: Foo)); +} \ No newline at end of file diff --git a/tests/derive_rc/successes/async_method.rs b/tests/derive_rc/successes/async_method.rs new file mode 100644 index 0000000..b41a396 --- /dev/null +++ b/tests/derive_rc/successes/async_method.rs @@ -0,0 +1,20 @@ +use std::rc::Rc; + +use impls::impls; + +#[blanket::blanket(derive(Rc))] +trait Foo { + async fn bar(&self); +} + +#[derive(Default)] +struct Baz; + +impl Foo for Baz { + async fn bar(&self) {} +} + +fn main() { + assert!(impls!(Baz: Foo)); + assert!(impls!(Rc: Foo)); +} \ No newline at end of file diff --git a/tests/derive_ref/successes/async_assoc_function.rs b/tests/derive_ref/successes/async_assoc_function.rs new file mode 100644 index 0000000..118c0bd --- /dev/null +++ b/tests/derive_ref/successes/async_assoc_function.rs @@ -0,0 +1,18 @@ +use impls::impls; + +#[blanket::blanket(derive(Ref))] +trait Foo { + async fn bar(); +} + +#[derive(Default)] +struct Baz; + +impl Foo for Baz { + async fn bar() {} +} + +fn main() { + assert!(impls!(Baz: Foo)); + assert!(impls!(&Baz: Foo)); +} \ No newline at end of file diff --git a/tests/derive_ref/successes/async_method.rs b/tests/derive_ref/successes/async_method.rs new file mode 100644 index 0000000..3903059 --- /dev/null +++ b/tests/derive_ref/successes/async_method.rs @@ -0,0 +1,18 @@ +use impls::impls; + +#[blanket::blanket(derive(Ref))] +trait Foo { + async fn bar(&self); +} + +#[derive(Default)] +struct Baz; + +impl Foo for Baz { + async fn bar(&self) {} +} + +fn main() { + assert!(impls!(Baz: Foo)); + assert!(impls!(&Baz: Foo)); +} \ No newline at end of file