rint!() { /* proc-macro */ }Expand description
Generate RInt type from value range, auto select RRxx value type
- full form
rint!(MIN..=MAX, default = DEFAULT, step = STEP, bits = BITS),MINandMAXis required, others is optional - range
MIN..=MAXis same as `MIN..MAX+1`` - if
defaultnot setted, then isMIN - if
stepnot setted, then is 1,stepmust >= 1, and must ensureMIN % STEP == 0 && MAX % STEP == 0 && DEFAULT % STEP == 0 - if
bitsnot setted, then is((MAX - MIN) / STEP).bit_width()
ⓘ
rint!(-10..=100) // RInt<u7, RRI8<-10, 100>>
rint!(-10..=100, default = 3) // RInt<u7, RRI8<-10, 100, 3>>
rint!(-10..=100, default = 20, step = 10) // RInt<u4, RRI8<-10, 100, 20, 10>>
rint!(3..50, default = 20) // RInt<u6, RRU8<3, 49, 20>>
rint!(3..50, default = 20, bits = 6) // RInt<u7, RRU8<3, 49, 20>>