Closed Eh2406 closed 3 years ago
Oh, interesting, I didn't even know that traits could have associated constants now. Absolutely! Want to submit a PR? I don't think it'll make much difference in practice, but it is maybe a little nicer. It is a breaking change to left-right
, but I think that's fine since it's so new and still pre-1.0
.
One thing I do worry about with DropBehavior
is that the compiler gets smart enough that it recognizes that the Drop
implementation for Aliased<_, NoDrop>
is a no-op, and therefore decides to lay it out differently in memory. I don't think that's something it does, but it is something that making it a constant will make it more likely optimization. But that said, if that optimization is possible, it would make what we're doing unsound regardless of whether it's an associated const or an fn
, so the change is likely a good one anyway.
Want to submit a PR?
It seems fairly straight forward, so I think I'd prefer to leave it open for someone with less experience to pick up. I am open to mentoring or pair programming or answering questions for anyone that does want to give it a try.
Want to submit a PR?
It seems fairly straight forward, so I think I'd prefer to leave it open for someone with less experience to pick up. I am open to mentoring or pair programming or answering questions for anyone that does want to give it a try.
I'll give it a shot. I'm confident with Rust, not so much with open source development.
Let us know how we can help!
Will do!
PR made.
Since evmap depends on the crates.io version of left-right, how should I handle propagating this change into evmap? Or should I leave the changes just to left-right.
I would think that you would change this line to left-right = { path = "../left-right", version = "0.11.0" }
. That tells Cargo to use the path for development but depend on the next crates.io version on publish. But I don't know why that is set up to depend on the version from crates.io
now, so we may want @jonhoo's explanation of the current set up.
Yeah, that works fine. All tests pass under new implementation, holding off on any more commits though until we get some feedback on the structure.
@Eh2406 is exactly right that left-right
needs to become a path dependency to use the new behavior of left-right
until I do a release. I commented in the PR :)
This was fixed in #87.
That feels less complicated than a method that returns a constant.