rojo-rbx / rbx-dom

Roblox DOM and (de)serialization implementation in Rust
MIT License
113 stars 45 forks source link

Add method for getting the superclasses of an Instance to rbx_reflection #402

Closed Dekkonot closed 6 months ago

Dekkonot commented 6 months ago

It's fairly common to need a list of superclasses for a class, so we should provide a method for it. This is an implementation.

It uses a HashSet for convenience. It's slightly more expensive than a Vec but provides an easy mechanism for checking if a class is in the returned set, so it feels worth it.

Dekkonot commented 6 months ago

I hadn't actually checked what the maximum amount was since it felt like it's either 1 or like 5 for most classes.

It turns out it is 6. With that in mind, I think a Vec is fine and I'm also going to update the starting capacity to just be 6.