-
Notifications
You must be signed in to change notification settings - Fork 9
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
Non-consuming RulesetCreated alternative #20
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.
I'm a fan. This seems pretty simple and the additional import is negligible considering the Rust compiler recommends it anyway even if it's missing.
I think I'll also implement |
I like it better than #19! It looks simpler and more maintainable. Only addition I'd recommend is sealing the trait, so it can't be implemented by other crates. It should be doable by renaming the current |
I renamed the traits with *Attr (instead of *Ref), which makes more sense. I'll do the same for the |
It's a good suggestion, but it is almost the case because |
This enables to make add_rule(), add_rules() and set_no_new_privs() available from a RulesetCreated reference. Implement AsMut<RulesetCreated>, required by RulesetCreatedAttr. Users need to import the RulesetCreatedAttr trait to call such methods. Closes landlock-lsm#19 Signed-off-by: Mickaël Salaün <mic@digikod.net>
This prepares for a more generic approach to use Ruleset. Signed-off-by: Mickaël Salaün <mic@digikod.net>
This enables to make handle_access() available from a Ruleset reference, similarly to the previous commit that added the RulesetCreatedAttr trait. Implement AsRef<Ruleset> to make it consistent with RulesetCreatedAttr. Users need to import the RulesetAttr trait to call such methods. Signed-off-by: Mickaël Salaün <mic@digikod.net>
@l0kod Do you think it would make sense to upload a new version to crates.io? The last 0.1.0 version on it seems to be more of a placeholder and it rather useless compared to all the progress the git repository has made. With the current master pushed to crates.io, the published version would actually be usable. Or do you have any major concerns with people using the current version of this crate? |
The 0.1.0 on crates.io is indeed a placeholder. I want to merge #12 (with the new |
This is an alternative implementation of #19, as I described in #16.
I think it is simpler than #19, with no duplicated method declarations. The main drawback is that we need to import the new
CreatedRulesetRef
trait.What do you think @andreaphylum and @cd-work ?