Making the associated constant Number::BYTES a usize.
As much as I prefer to have tighter types for variables, this seems to make writing code easier and cleaner.
This commit is contained in:
parent
946ad90fa0
commit
4aa410ad7e
@ -19,7 +19,7 @@ pub trait Number : Zero + One + Add<Output=Self> + Sub<Output=Self> +
|
||||
|
||||
|
||||
/// The amount of Bytes required to represent this Number.
|
||||
const BYTES: u8;
|
||||
const BYTES: usize;
|
||||
|
||||
|
||||
/// Create a number from a given string and base radix.
|
||||
@ -757,7 +757,7 @@ macro_rules! int_number_trait_impl
|
||||
type StrRadixError = ::std::num::ParseIntError;
|
||||
|
||||
|
||||
const BYTES: u8 = <$varType>::BYTES;
|
||||
const BYTES: usize = <$varType>::BYTES;
|
||||
|
||||
|
||||
fn from_str_radix(src: &str, radix: u32) ->
|
||||
@ -780,7 +780,7 @@ macro_rules! float_number_trait_impl
|
||||
type StrRadixError = ::std::num::ParseFloatError;
|
||||
|
||||
|
||||
const BYTES: u8 = $numBytes;
|
||||
const BYTES: usize = $numBytes;
|
||||
|
||||
|
||||
fn from_str_radix(src: &str, radix: u32) ->
|
||||
|
Loading…
x
Reference in New Issue
Block a user