1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#[derive(Clone, Debug)] pub enum Status { Active, Inactive, } pub struct User { pub name: String, pub status: Status, } impl User { pub fn new(name: &str, status: Status) -> Self { Self { name: name.to_string(), status, } } }