iderive
is a drop-in replacement for derive
that doesn't directly depend
on generic bounds. It only checks the types of a struct's fields when deriving
a trait.
```rust
struct TaggedIndex
let a = TaggedIndex::
This won't work because
deriverequires that
Timplements
Copyfor
TaggedIndex` to be able to derive it.
In contrast, iderive
only checks the struct's fields to determine if a
trait can be derived. Because usize
and PhantomData<T>
implements Copy
regardless of the type of T
, iderive(Copy)
will implement Copy
for
TaggedIndex
:
```rust
struct TaggedIndex
let a = TaggedIndex::
iderive
is currently implemented for Clone
, Copy
, Debug
,
Default
, PartialEq
, Eq
, PartialOrd
, Ord
and Hash
.