You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This struct is to make RawOpcode in const level to satisfy CompileTimeOpcode bound. It is pretty common (and already used by rustix itself) to plug a generated constants, eg. from linux_raw_sys, into the ioctl::{Getter,Setter,Updater} interface. This practice uses less magic numbers in Rust code and should not be called "bad".
The name Bad made it seem like something I shouldn't be using, but taking the value by name from linux_raw_sys seems less error prone than looking up these components in a C header file and hard-coding them.
I'm not sure about the alternative names here, but here are some candidates:
LiteralOpcode: but it can accept any const expression, not necessarily literals.
RawCompileTimeOpcode: really long to write.
ConstOpcode: seems like synonym to the trait CompileTimeOpcode.
RawOpcode: name collision with type alias RawOpcode.
The text was updated successfully, but these errors were encountered:
The name was taken from nix, which I assumed took it from some Linux kernel documentation. I have a memory of finding this document but I can't seem to find it now when I try to look for it.
This struct is to make
RawOpcode
in const level to satisfyCompileTimeOpcode
bound. It is pretty common (and already used byrustix
itself) to plug a generated constants, eg. fromlinux_raw_sys
, into theioctl::{Getter,Setter,Updater}
interface. This practice uses less magic numbers in Rust code and should not be called "bad".This issue was also mentioned in #861
I'm not sure about the alternative names here, but here are some candidates:
LiteralOpcode
: but it can accept any const expression, not necessarily literals.RawCompileTimeOpcode
: really long to write.ConstOpcode
: seems like synonym to the traitCompileTimeOpcode
.RawOpcode
: name collision with type aliasRawOpcode
.The text was updated successfully, but these errors were encountered: