Skip to content

Commit 0f558c6

Browse files
committed
feat(EnumHint): store optional mapping value information
1 parent 6dc9721 commit 0f558c6

File tree

1 file changed

+11
-1
lines changed
  • gdnative-core/src/export/property

1 file changed

+11
-1
lines changed

gdnative-core/src/export/property/hint.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,22 @@ where
116116
/// ```
117117
#[derive(Clone, Eq, PartialEq, Debug, Default)]
118118
pub struct EnumHint {
119-
values: Vec<String>,
119+
values: Vec<(String, Option<i64>)>,
120120
}
121121

122122
impl EnumHint {
123123
#[inline]
124124
pub fn new(values: Vec<String>) -> Self {
125+
let values = values.into_iter().map(|v| (v, None)).collect();
126+
EnumHint { values }
127+
}
128+
129+
#[inline]
130+
pub fn with_numbers(values: Vec<(String, i64)>) -> Self {
131+
let values = values
132+
.into_iter()
133+
.map(|(key, val)| (key, Some(val)))
134+
.collect();
125135
EnumHint { values }
126136
}
127137

0 commit comments

Comments
 (0)