Skip to content

Commit

Permalink
Add conversion from EnumItem to Enum for binary serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethloeffler committed Nov 1, 2024
1 parent 1184fa0 commit 4147ab9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions rbx_binary/src/serializer/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use ahash::{HashMap, HashMapExt, HashSetExt};
use rbx_dom_weak::{
types::{
Attributes, Axes, BinaryString, BrickColor, CFrame, Color3, Color3uint8, ColorSequence,
ColorSequenceKeypoint, Content, Enum, Faces, Font, MaterialColors, Matrix3, NumberRange,
NumberSequence, NumberSequenceKeypoint, PhysicalProperties, Ray, Rect, Ref,
ColorSequenceKeypoint, Content, Enum, EnumItem, Faces, Font, MaterialColors, Matrix3,
NumberRange, NumberSequence, NumberSequenceKeypoint, PhysicalProperties, Ray, Rect, Ref,
SecurityCapabilities, SharedString, Tags, UDim, UDim2, UniqueId, Variant, VariantType,
Vector2, Vector3, Vector3int16,
},
Expand Down Expand Up @@ -970,10 +970,10 @@ impl<'dom, 'db, W: Write> SerializerState<'dom, 'db, W> {
let mut buf = Vec::with_capacity(values.len());

for (i, rbx_value) in values {
if let Variant::Enum(value) = rbx_value.as_ref() {
buf.push(value.to_u32());
} else {
return type_mismatch(i, &rbx_value, "Enum");
match rbx_value.as_ref() {
Variant::Enum(value) => buf.push(value.to_u32()),
Variant::EnumItem(EnumItem { value, .. }) => buf.push(*value),
_ => return type_mismatch(i, &rbx_value, "Enum or EnumItem"),
}
}

Expand Down

0 comments on commit 4147ab9

Please sign in to comment.