-
Notifications
You must be signed in to change notification settings - Fork 714
Open
Labels
Description
One thing I ran into almost immediately when trying to nicely define a set of flags like you would in C (with something like CLONE_NEWUSER|CLONE_NEWUTS|CLONE_NEWNS
or whatever) is that you can't do it with the nix
structs without declaring a variable mut
and operating on it.
let mut sigmask = signal::SigSet::empty();
sigmask.add(signal::Signal::SIGTTOU);
sigmask.add(signal::Signal::SIGTTIN);
// etc
What if we made it so you could do this instead?
let sigmask = signal::SigSet::empty()
.add(signal::Signal::SIGTTOU)
.add(signal::Signal::SIGTTIN);
Which allows you to write it (IMO) more concisely but also doesn't mean that you have to make the variable mutable. It also better matches the Iterator
combinators.