Create Your Own Event Queue 76 What does #[repr(packed)] do? The #[repr(packed)] annotation is new to us. Usually, a struct will have padding either between fields or at the end of the struct. This happens even when we've specified #[repr(C)]. The reason has to do with efficient access to the data stored in the struct by not having to make multiple fetches to get the data stored in a struct field. In the case of the Event struct, the usual padding would be adding 4 bytes of padding at the end of the events field. When the operating system expects a packed struct for Event, and we give it a padded one, it will write parts of event_data to the padding between the fields. When you try to read event_data later on, you'll end up only reading the last part of event_data, which happened to overlap and get the wrong data The fact that the operating systemexpects a packed Event struct isn't obvious by reading the manpages for Linux, so you have to read the appropriate C header files to know for sure. Y ou could of course simply rely on the libc crate (https://github. com/rust-lang/ libc ), which we would do too if we weren't here to learn things like this for ourselves. So, now that we've finished walking through the code, there are a few topics that we promised to get back to. Bitflags and bitmasks Y ou'll encounter this all the time when making syscalls (in fact, the concept of bitmasks is pretty common in low-level programming). A bitmask is a way to treat each bit as a switch, or a flag, to indicate that an option is either enabled or disabled. 