You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constructing a new {U}Int<{u/i}{8/16/32/whatever}, ...> each time we need to assign something seems really tedious. In getters we have a .value(), is there an API for us to use in setters?
(edit by maintainer: set_field1(u4::new(2)) vs. set_field1(2))
The text was updated successfully, but these errors were encountered:
fnset_field1<T:Into<uN>>(value:T){let value:uN = value.into();// same stuff as in our current set_field1(value)}
which would be possible since arbitrary_int provides these conversions (actually it doesn't currently), although we'd special case only arbint fields based on that (which would again be done by looking at the type name, or probably type system magic).
I prototyped this, the result being:
meaning you'd write 1u8 here instead of u2::new(1) or 1.into(). Not sure if that's useful enough?
I would not like set_field1_primitive(value: u8), though it would be easier to type with editor help, also not set_field1_(value: u8) to make it shorter. Although set_field1 would not panic, while set_field1_ does.
Arbitrary integers in rust itself would make this easy to write
constructing a new {U}Int<{u/i}{8/16/32/whatever}, ...> each time we need to assign something
seems
really tedious. In getters we have a .value(), is there an API for us to use in setters?(edit by maintainer:
set_field1(u4::new(2))
vs.set_field1(2)
)The text was updated successfully, but these errors were encountered: