Attribute Macro kas_macros::autoimpl
source · #[autoimpl]
Expand description
A variant of the standard derive
macro
See impl_tools::autoimpl
for full documentation.
The following traits are supported:
Path | ignore | using | notes |
---|---|---|---|
::core::borrow::Borrow<T> | - | borrow target | T is type of target field |
::core::borrow::BorrowMut<T> | - | borrow target | T is type of target field |
::core::clone::Clone | yes | - | ignored fields use Default::default() |
::core::cmp::Eq | * | - | *allowed with PartialEq |
::core::cmp::Ord | yes | - | |
::core::cmp::PartialEq | yes | - | |
::core::cmp::PartialOrd | yes | - | |
::core::convert::AsRef<T> | - | ref target | T is type of target field |
::core::convert::AsMut<T> | - | ref target | T is type of target field |
::core::default::Default | - | - | impl_default is a more flexible alternative |
::core::fmt::Debug | yes | - | |
::core::hash::Hash | yes | - | |
::core::marker::Copy | * | - | *allowed with Clone |
::core::ops::Deref | - | deref target | type Target is type of target field |
::core::ops::DerefMut | - | deref target | type Target is type of target field |
::kas::classes::HasBool | - | deref target | |
::kas::classes::HasStr | - | deref target | |
::kas::classes::HasString | - | deref target | |
class_traits | - | deref target | implements each kas::class trait |
Examples
Implement all kas::class
trait over a wrapper type:
# use kas_macros::autoimpl;
#[autoimpl(class_traits using self.0 where T: trait)]
struct WrappingType<T>(T);