-
Notifications
You must be signed in to change notification settings - Fork 10
Description
In general, when talking about numbers of bytes and things like that, we don't care about negative numbers of bytes, so an unsized type could be good. Also, usize is specifically for representing the size of things. I think.
If a signed thing is necessary, then perhaps it could have a different type. For example, Offset could be defined with i64 as it's inner. An Offset could also be the result of a Size +/- some value.
Maybe Size could be generic on the type and constrain it to be some arithmetic, integer value?
Alternatively, a method like Size::ubytes() could return the size as an unsigned value? I just have a bunch of functions that take a value as an unsigned number of bytes, so I'd have to do a lot of casting everywhere to replace them with Size values, which I want to do :)