iggy icon indicating copy to clipboard operation
iggy copied to clipboard

Use own-defined types for various simple types

Open hubcio opened this issue 1 year ago • 0 comments

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.

hubcio avatar Oct 02 '23 16:10 hubcio