-
Notifications
You must be signed in to change notification settings - Fork 681
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
ioctl! macro does not allow definition of public ioctl wrappers #184
Comments
Ah, sure enough. I was hoping that it would be possible to just put |
Consumers of the API may control visibility by means of a module. The following is a useful pattern that may be used by implementors (here for a couple of i2cdev ioctl definitions): mod ioctl { ioctl!(bad set_i2c_slave_address with super::I2C_SLAVE); ioctl!(bad i2c_smbus with super::I2C_SMBUS); } This resolves nix-rust#184.
@jmesmon Any thoughts on having pub be what the ioctl supplies. This is what I have implemented now in my PR (#185). I'm thinking a common pattern might be to close over Other feedback welcome. If there are warts with the new interface, its probably best to fix them now before too many people have updated their code. |
Well, I looked a bit further at what the current ioctl! macro provides while updating a few of my crates, and I ended up needing some wrapping functions anyhow (bare ioctls rarely make sense). So despite me opening this issue, I'm not sure I really need a way to make the wrappers pub (that was just the first thing I reached for when updating things). |
Consumers of the API may control visibility by means of a module. The following is a useful pattern that may be used by implementors (here for a couple of i2cdev ioctl definitions): mod ioctl { ioctl!(bad set_i2c_slave_address with super::I2C_SLAVE); ioctl!(bad i2c_smbus with super::I2C_SMBUS); } This resolves nix-rust#184.
There doesn't seem to be an easy way to simply make public the generated ioctl wrappers without essentially duplicating all of their work (writing wrapping functions with the appropriate signature)
An easy way to prefix with 'pub' would be nice.
The text was updated successfully, but these errors were encountered: