HarfangLab / endpoint-sec

Rust Bindings for Endpoint Security
https://docs.rs/endpoint-sec/
Apache License 2.0
21 stars 6 forks source link

Add `#[repr(transparent)]` on eligible structs #64

Closed PaulDance closed 1 week ago

PaulDance commented 1 week ago

This proposes to add #[repr(transparent)] wherever possible. Currently, this only concerns some structs.

The one for which it probably makes the most sense is AuditToken since it directly stores an audit_token_t in a newtype fashion. That is put in the first commit.

The rest is only structs with a single pointer-like field, including a good part of the events. This might not make too much sense as their respective field is not public, therefore no public ABI is really to be guaranteed, and potential future additional fields will render it impossible to keep, but is still proposed for completion's sake. These are put in the following commits so they may be simply grafted away if need be.

roblabla commented 1 week ago

Hmm, yeah I think it makes sense on AuditToken on Message, but I think I'd rather not offer this on the Event structs, as I wouldn't want people to rely on it only for us to remove it when we need to add a version field on one of them.

PaulDance commented 1 week ago

Sounds fair, done!

roblabla commented 1 week ago

Can you also drop it on Thread/File/ThreadState? Those could also have fields that are version-dependant ^^'.

PaulDance commented 1 week ago

Woops, sorry, I didn't quite understand that from your first message. Done!