-
Notifications
You must be signed in to change notification settings - Fork 10
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
Finish implementation of the contact field #6
Conversation
We have the contact field: https://github.com/coredump-ch/spaceapi-rs/blob/81d39efffcd4e5b4f4d04190ea20fa2dc7d5f3f8/src/status.rs#L46 I think this issue should be about this restriction:
At least one is difficult to verify at compile time. |
No, that's in #7. Is the contact completely implemented otherwise? |
Oh its not complete. |
Refs #6. This is now pretty awkward to use. We should probably implement the builder pattern to construct objects like the contact object.
Does someone have time to review this? Btw, we should soon derive Eq for all structs, otherwise testing nested objects becomes awkward. |
Actually we can only implement |
Just derive |
//! email: Value("[email protected]".into()), | ||
//! ml: Absent, | ||
//! jabber: Absent, | ||
//! issue_mail: Absent, |
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.
This looks silly. Maybe we could use a builder here? Or at least a initializer method. We could also implement the Default
trait and use it with update syntax:
Contact { irc: Value("irc://freenode.net/#coredump".into()), ..Default::default() }
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.
Yeah, I already noted in the commit message that we need something to handle this :) But that's another PR.
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.
Default also looks interesting, didn't know it yet. We could implement Absent
as a default for Optional
and then derive Default
for all structs. Although that would mean that things like longitude and latitude would probably default to 0.0
, which sucks :(
The Is this good otherwise? |
If you don't want to bother with the initialization for now I would consider it good 👍 |
Finish implementation of the contact field
http://spaceapi.net/documentation