Skip to content

Commit

Permalink
add reflect for BinaryHeap (#12503)
Browse files Browse the repository at this point in the history
# Objective
I wanted to have reflection for BinaryHeap for a personal project.

I'm running into some issues:
- I wanted to represent BinaryHeap as a reflect::List type since it's
essentially a wrapper around a Vec, however there's no public way to
access the underlying Vec, which makes it hard to implement the
reflect::List methods. I have omitted the reflect::List methods for
now.. I'm not sure if that's a blocker?
- what would be the alternatives? Simply not implement `reflect::List`?
It is possible to implement `FromReflect` without it. Would the type be
`Struct` then?

---------

Co-authored-by: Charles Bournhonesque <cbournhonesque@snapchat.com>
  • Loading branch information
cBournhonesque and cbournhonesque-sc authored Mar 17, 2024
1 parent 5d0ff60 commit ea6540d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions crates/bevy_reflect/src/impls/std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ impl_reflect_value!(::std::ffi::OsString(
));
#[cfg(not(any(unix, windows)))]
impl_reflect_value!(::std::ffi::OsString(Debug, Hash, PartialEq));
impl_reflect_value!(::alloc::collections::BinaryHeap<T: Clone>);

macro_rules! impl_reflect_for_veclike {
($ty:path, $insert:expr, $remove:expr, $push:expr, $pop:expr, $sub:ty) => {
Expand Down

0 comments on commit ea6540d

Please sign in to comment.