taiki-e / derive_utils

A procedural macro helper for easily writing custom derives for enums.
https://docs.rs/derive_utils
Apache License 2.0
31 stars 2 forks source link

Weaken requirements to a number of enum variants #15

Closed blackbeam closed 5 years ago

blackbeam commented 5 years ago

Hi.

This PR is a straightforward fix for the issue where the following snippet of code won't compile with error: cannot be implemented for enums with less than two variants:

#[derive(Read, Write)]
enum Stream {
    Some(SomeStream),
    #[cfg(features = "other")]
    Other(OtherStream),
}
taiki-e commented 5 years ago

Looks good, thanks!

bors r+

bors[bot] commented 5 years ago

Build succeeded

taiki-e commented 5 years ago

Published in 0.9.1.