File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
crates/bevy_reflect/src/enums Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,22 @@ impl DynamicEnum {
140
140
self . variant = variant. into ( ) ;
141
141
}
142
142
143
+ /// Get a reference to the [`DynamicVariant`] contained in `self`.
144
+ pub fn variant ( & self ) -> & DynamicVariant {
145
+ & self . variant
146
+ }
147
+
148
+ /// Get a mutable reference to the [`DynamicVariant`] contained in `self`.
149
+ ///
150
+ /// Using the mut reference to switch to a different variant will ___not___ update the
151
+ /// internal tracking of the variant name and index.
152
+ ///
153
+ /// If you want to switch variants, prefer one of the setters:
154
+ /// [`DynamicEnum::set_variant`] or [`DynamicEnum::set_variant_with_index`].
155
+ pub fn variant_mut ( & mut self ) -> & mut DynamicVariant {
156
+ & mut self . variant
157
+ }
158
+
143
159
/// Create a [`DynamicEnum`] from an existing one.
144
160
///
145
161
/// This is functionally the same as [`DynamicEnum::from_ref`] except it takes an owned value.
You can’t perform that action at this time.
0 commit comments