Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
Enum with
Using Enums in

Examples of Enum in Rust

There are different examples of enum decleration and usage in Rust programming language.

Below files are associated with Rust turorial episode No 13 in Persian:

C Like enums

Example of C like enums and getting associated number to each variant by compiler are in the CLike file.

C Like enums with custom values

Example of how we can change stored value of enum varients in the memory is in the Http file. Explained by a simple enum representing brief version of http statuts.

Enum with Values

Example of how storing values in the enums is in the Enum with file.

Enum with struct-like variants

The example of how we could declare enum varients like structs is in the Struct file.

Using enums in the structs

We can use enums like fields of a struct. The example of this usage is in the Using Enums in file.

You can’t perform that action at this time.