Skip to content
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

Merged
merged 1 commit into from
Dec 4, 2015
Merged

Finish implementation of the contact field #6

merged 1 commit into from
Dec 4, 2015

Conversation

dbrgn
Copy link
Collaborator

@dbrgn dbrgn commented Dec 3, 2015

@rnestler
Copy link
Member

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:

You must define at least one which is in the list of allowed values of the issue_report_channels field.

At least one is difficult to verify at compile time.

@dbrgn
Copy link
Collaborator Author

dbrgn commented Nov 18, 2015

No, that's in #7. Is the contact completely implemented otherwise?

@rnestler
Copy link
Member

Oh its not complete.

@rnestler rnestler changed the title Implement contact field Finish implementation of the contact field Nov 18, 2015
@dbrgn dbrgn self-assigned this Dec 3, 2015
Refs #6.

This is now pretty awkward to use. We should probably implement the
builder pattern to construct objects like the contact object.
@dbrgn
Copy link
Collaborator Author

dbrgn commented Dec 3, 2015

Does someone have time to review this?

Btw, we should soon derive Eq for all structs, otherwise testing nested objects becomes awkward.

@dbrgn
Copy link
Collaborator Author

dbrgn commented Dec 4, 2015

Btw, we should soon derive Eq for all structs, otherwise testing nested objects becomes awkward.

Actually we can only implement PartialEq, because some of the structs contain floats and floating point numbers don't fulfill the reflexive property.

@rnestler
Copy link
Member

rnestler commented Dec 4, 2015

Just derive PartialEq then, at least for contact in this PR.

//! email: Value("[email protected]".into()),
//! ml: Absent,
//! jabber: Absent,
//! issue_mail: Absent,
Copy link
Member

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() }

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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 :(

@dbrgn
Copy link
Collaborator Author

dbrgn commented Dec 4, 2015

The PartialEq will be a separate PR. It's already on my laptop.

Is this good otherwise?

@dbrgn dbrgn mentioned this pull request Dec 4, 2015
@rnestler
Copy link
Member

rnestler commented Dec 4, 2015

If you don't want to bother with the initialization for now I would consider it good 👍

dbrgn added a commit that referenced this pull request Dec 4, 2015
Finish implementation of the contact field
@dbrgn dbrgn merged commit 73ff437 into master Dec 4, 2015
@dbrgn dbrgn deleted the issue6 branch December 4, 2015 10:22
@rnestler rnestler mentioned this pull request Dec 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants