Description
Currently, oblux only provides U7, U15, U31, U63, U127 types and each one contains the corresponding underlying u* type. We want to introduce the following NonZero* types:
NonZeroU7
NonZeroU15
NonZeroU31
NonZeroU63
NonZeroU127
Implementation
Introduce the above types that will wrap the corresponding NonZeroU* types from the core library. We're specifically interested in the memory layout when wrapped by an Option. The implemented representation must use null pointer optimization.
Test
Add new doc tests to verify the constraints.
Acceptance Criteria
Description
Currently,
obluxonly providesU7,U15,U31,U63,U127types and each one contains the corresponding underlyingu*type. We want to introduce the followingNonZero*types:Implementation
Introduce the above types that will wrap the corresponding
NonZeroU*types from the core library. We're specifically interested in the memory layout when wrapped by anOption. The implemented representation must use null pointer optimization.Test
Add new doc tests to verify the constraints.
Acceptance Criteria
cargo buildsucceeds.size_of::<Option<NonZeroU7>>() == size_of::<NonZeroU7>() == size_of::<U7>().size_of::<Option<NonZeroU15>>() == size_of::<NonZeroU15>() == size_of::<U15>().size_of::<Option<NonZeroU31>>() == size_of::<NonZeroU31>() == size_of::<U31>().size_of::<Option<NonZeroU63>>() == size_of::<NonZero63>() == size_of::<U63>().size_of::<Option<NonZeroU127>>() == size_of::<NonZeroU127>() == size_of::<U127>().