Enums With Data Type

This lesson tells you how to make an enum construct by adding a data type.

We'll cover the following

By default, the Rust compiler infers the data type for all variants of an enum. However, it is possible to use different data types for different variants of an enum.


The data type can be added to each variant enclosed within round brackets ().

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy