-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for PartialEq and Eq for objects with an id #18
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall good, glad to have this!
There's one line in the comment for impl_structure_properties!
which seems out of place (see my comment on it) but besides that 👍.
@@ -86,3 +86,33 @@ macro_rules! impl_room_object_properties { | |||
)* | |||
); | |||
} | |||
|
|||
|
|||
// Macro for mass implementing `StructureProperties`, `PartialEq` and `Eq` for a type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could be a doc comment with //!
///
, but it's not a big deal.
Edit: I'd completely forgotten the difference between //!
and ///
while reviewing these prs.
The main reason I like doc comments for this sort of thing is that it syntactically attaches the comment to the macro. Even if it's just internal comments for an internal macro, it makes it even clearer that this comment is for the thing under it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the //
for ///
, but I'll wait until #19 is merged before moving this one with the other.
// | ||
// # Example | ||
// ``` | ||
// macro_rules!(OwnedStructure, Structure, StructureContainer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless I'm missing something, I think this line was meant to be something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The copy/paste monster is real!
Glad to have you improving this repo! Hope my PR reviews aren't too scrutinous. |
Absolutely not, it's all very constructive. Still learning the ropes of rust (which I really like), so your comments help me getting a feel for what is usually left unsaid and best practices. Thanks for taking the time to review my small avalanche of PRs! |
Glad to hear it's constructive! Reviewing a small avalanche of PRs is only a tiny bit of work compared to the benefit of extra eyes on the project and the contributions themselves. Thanks for coming and improve |
I'll merge this manually since the changes in |
Thanks! I was going through the changes. I'll leave it to you. |
Ah yeah- that could work! |
This PR adds methods to fetch
id
s on the object where this was missing.Given those, it also implements
PartialEq
andEq
for all objects with an id.Finally, it also adds
PartialEq
andEq
forRoom
based on name.All of this for partitioning creeps by rooms...