Enums are a way to define different variants of a single type.

enum Message {
	Quit,
	ChangeColor(i32, i32, i32),
	Move { x: i32, y: i32},
	Write(String),
}

using :: you can access the Message variants within the scope of the enum.

let error: Message = Message::Quit;
let new_color: Message = Message::ChangeColor(202, 182, 95);
let message: Message = Message::Write("Hello world");

enum constructors are technically functions, and can be useful once we start using iterators, and closures; to functions to functions, like when converting a vector of strings to a vector of Messages.

enum Message {
Write(String),
}
 
let v = vec!["Hello".to_string(), "World".to_string()];
 
let v1: Vec<Message> = v.into_iter().map(Message::Write).collect();
 
// into_iter()     .map().    .collect()