fenestroj
Easier to use wrappers for winapi stuff.
All wrappers are kept in feature gated modules the same as how winapi works.
Conventions
- Names:
- Snake case function names:
GetLastErrorbecomesget_last_error - If there's an
AandWvariant of awinapifunction, theWvariant is used without "_w" on the end:GetMessageWbecomesget_message - Some functions are new utilities to this crate, they just have names that
don't conflict with any
winapiname.
- Snake case function names:
- Arguments:
- Enums are used when possible.
- If there's some "obvious" default for the user to calculate then
Optionis sometimes used and it will do the calculation for you. - Functions with a large number of arguments are converted to take a single struct with a field for each argument so you don't have to remember the ordering perfectly.
- Return Values:
- Usage of
bool,Option, orResultis done whenever possible. - Numeric codes are given newtype wrappers as often as possible:
u32error values become wrapped inpub struct ErrorCode(pub u32)for example.
- Usage of
- Safety:
- Things are all still left as
unsafeuntil a careful investigation of the safety involved can be done. - The investigation process is generally "ask WinBun and hope they're not too busy to answer".
- Things are all still left as