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

Constants as Capability Enum #1

Open
Latrasis opened this issue Jan 21, 2016 · 7 comments
Open

Constants as Capability Enum #1

Latrasis opened this issue Jan 21, 2016 · 7 comments
Milestone

Comments

@Latrasis
Copy link

It would seem like having capabilities as part of a general 'Cabability' enum type - instead of having a large list of constants. Thoughts?

@gcmurphy
Copy link
Owner

Agree. I can't remember why I switched to const new types, but it doesn't seem that it was necessary / or really worth it.

Let me know what you think of this commit ae09955.

Do you think I should move to camel case for the Capability Enum?

@gcmurphy gcmurphy modified the milestones: 0.1.1, 0.2.0 Jan 21, 2016
@Latrasis
Copy link
Author

Much better, but having a Capability struct is a bit redundant, could you simply have Capability enum and impl methods on the enum instead?

@gcmurphy
Copy link
Owner

That's what the change did. It removed the Capability struct. There is a Capabilities struct which represents a set of Capabilities for a process etc if that's what you mean? Anyway this change is now in 0.2.0.

@Latrasis
Copy link
Author

Sorry, yes I meant about replacing the Capabilities altogether. Is there are reason to have it - instead of a [Cabability; N] type and iterating over it?

@gcmurphy
Copy link
Owner

That struct exists to hold the libcap handle and ensure it is released properly etc. Originally I added it as I basically just wanted to wrap the libcap capi calls. But I'll look into how I could ditch it as it should provide a nicer interface.

@Latrasis
Copy link
Author

In terms of naming, the CAP prefix for each Capability does seem a bit redundant. In rust, it's formal to have CAPS for const's and CamelCases for types. 👍

@vorner
Copy link

vorner commented Jan 17, 2020

Capabilities are bit flags in the C API, would it make sense to actually use the bitflags crate?

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

No branches or pull requests

3 participants