iggy
iggy copied to clipboard
Use own-defined types for various simple types
Instead of having u32
for MessageSize
we would like to have own types for it.
Same can be applied to offset
, user_id
, etc.
This is potentially big change because both server and SDK have to be changed, in many different files.
There are 2 ways to do it:
- type aliases:
type MessageSize = u32;
- Newtype pattern:
pub struct MessageSize(u32);
- see https://doc.rust-lang.org/rust-by-example/generics/new_types.html
Contributor doing this PR should weight and decide what's better to use here.