Module show_notes::e031::unions

source ·
Expand description

Demonstrate unions! Combines an enum and a union into a struct that acts mostly like a regular Rust enum.

Structs

  • Uses an enum and a union to get close to a regular Rust enum.
  • A simple type designed to demo unions. See the body of demo_union.

Enums

  • For tagging the type in Either. See the body of demo_union.

Functions

  • Builds an instance of Either, a manually-managed “tagged union” type.

Unions

  • A union, to be used as the inner value for Either.