Skip to content

Commit

Permalink
edit explicit enum
Browse files Browse the repository at this point in the history
  • Loading branch information
krakow10 committed Feb 23, 2024
1 parent e35558b commit 502e563
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions rbx_types/src/basic_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,19 @@ impl Enum {
)]
pub struct ExplicitEnum {
name: String,
value: u32,
value: Enum,
}

impl ExplicitEnum {
pub fn new(name: String, value: u32) -> Self {
Self { name, value }
Self { name, value: Enum::from_u32(value) }
}

pub fn name(&self) -> &str {
self.name.as_str()
}

pub fn to_u32(&self) -> u32 {
pub fn value(&self) -> Enum {
self.value
}
}
Expand Down

0 comments on commit 502e563

Please sign in to comment.