iroha icon indicating copy to clipboard operation
iroha copied to clipboard

Replace `FromVariant` with `derive_more::from`

Open mversic opened this issue 2 years ago • 3 comments

derive_more::from offers the same functionality as our FromVariant. Considering that we're making more and more use of the derive_more we should remove our custom implementation in favor of derive_more.

TryInto/TryFrom can also be derived to go from enum into one of it's variants

mversic avatar Jun 02 '22 08:06 mversic

We need to make sure that we can cover the functionality already present. Since we already have an implementation, the missing functionality can be merged into derive_more.

appetrosyan avatar Jun 02 '22 14:06 appetrosyan

Example: unboxing https://github.com/JelteF/derive_more/issues/153

appetrosyan avatar Jun 02 '22 14:06 appetrosyan

seems that it's doable with derive_more. If we find derive_more to be too verbose, we can make our own macro wrapper which will delegate to derive_more

mversic avatar Jun 07 '22 07:06 mversic

Currently derive_more doesn't allow returning custom error types from generated TryInto impls, and this breaks our EvaluatesTo type checking. This is going to be fixed in 1.0.0 release, which seems to be happening pretty soon (80% of the milestone completed). So I suggest we revisit this at a later time.

ilchu avatar Feb 23 '23 07:02 ilchu