tokio-rs / io-uring

The `io_uring` library for Rust
Apache License 2.0
1.16k stars 129 forks source link

feat: more derive traits for Fixed type #279

Open andrewgazelka opened 4 months ago

quininer commented 4 months ago

There's no harm in that, but Fixed is just an interface constraint and you're not expected to put it into a HashMap.

andrewgazelka commented 4 months ago

There's no harm in that, but Fixed is just an interface constraint and you're not expected to put it into a HashMap.

Is there any reason why putting it in a HashMap would be harmful? I think it can be nice to not have to convert across types.

Similarly, in stdlib it will have these traits because

pub type RawFd = c::c_int;

perhaps we could do the same thing for Fixed?

/// Raw file descriptors.
#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
pub type RawFd = c::c_int;
quininer commented 4 months ago

There's no harm in that

There's no harm in that.

Fixed is just an interface constraint

see https://github.com/tokio-rs/io-uring/blob/master/src/types.rs#L35

I can accept this PR, but I'm just reminding you that this is not how it is designed to be used. The type of io_uring::types should only be used when construct opcode.