The following enumswithdata program shows a Rust enum whose
variants carry data. It has all three kinds of variant: a unit variant
with no data, a tuple variant with unnamed fields, and a struct variant
with named fields. A match or if let unpacks
each variant's data.
This zip file contains the complete crate.