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

conventions: Codify use of newtypes #291

Merged
merged 1 commit into from
Mar 12, 2016

Conversation

kamalmarhubi
Copy link
Member

No description provided.

```rust
pub struct SigSet(libc::sigset_t);

impl SigSet {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what the right thing to suggest for naming standards is though. Should this be Sigset?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SigSet feels right to me in this case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. So, let's add another sentence that mentions that we use the rust convention of camel case names for structs. Then we can merge this PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how's the change?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks good to me.

@kamalmarhubi
Copy link
Member Author

r? @fiveop

@kamalmarhubi
Copy link
Member Author

One thing I've wondered about is

pub struct SigSet {
    sigset: libc::sigset_t,
}

vs

pub struct SigSet(libc::sigset_t);

vs

pub struct SigSet {
    inner: libc::sigset_t,
}

There's also a possibility of introducing a something like the Rust project's *Inner traits: https://github.com/rust-lang/rust/blob/master/src/libstd/sys/common/mod.rs#L54-L76

I brought some of this up in review of #311.

@kamalmarhubi
Copy link
Member Author

Deferring choice of how to represent the newtype. @homu r=@posborne

@homu
Copy link
Contributor

homu commented Mar 12, 2016

📌 Commit 6f0bcde has been approved by @posborne

@homu
Copy link
Contributor

homu commented Mar 12, 2016

⚡ Test exempted - status

@homu homu merged commit 6f0bcde into nix-rust:master Mar 12, 2016
homu added a commit that referenced this pull request Mar 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants