Trevor Spiteri
c6cacadfa0
use imports throughout doc examples
2019-08-16 22:57:31 +02:00
Trevor Spiteri
637a87524c
impl LossyFrom for infallible conversions from integer to integer
2019-08-16 21:59:44 +02:00
Trevor Spiteri
7b3b76f78c
simplify code for many method calls
2019-08-16 21:16:55 +02:00
Trevor Spiteri
8adaa2b5d1
add missing impl LossyFrom<bool> for Fixed which can represent 1
2019-08-16 20:31:41 +02:00
Trevor Spiteri
5d87acd2d3
clean up code in convert.rs
2019-08-16 20:27:57 +02:00
Trevor Spiteri
5e44537bc6
inline function
2019-08-16 17:17:22 +02:00
Trevor Spiteri
87390efaa3
deprecate sealed module
2019-08-16 16:54:16 +02:00
Trevor Spiteri
875305bdc3
remove Frac: LeEqU bounds from struct Fixed, leave them for impl
2019-08-16 15:58:10 +02:00
Trevor Spiteri
9eab1c5be9
add {from,to}_num, deprecate sealed::{Int,Float,Fixed}
...
* new methods from_num, to_num, and their checked versions
* deprecate all other from_* and to_*, except for the FromFixed and
ToFixed traits
* deprecate sealed::{Fixed,Int,Float}
* removed SealedFixed, replace Sealed{Int,Float} with
{Int,Float}Helper
2019-08-16 15:45:26 +02:00
Trevor Spiteri
91a1f1554b
add struct ToFixedHelper
2019-08-15 22:49:44 +02:00
Trevor Spiteri
aac10de995
add from* methods to Wrapping
2019-08-15 14:38:27 +02:00
Trevor Spiteri
b9d6cee72d
fmt
2019-08-14 16:56:50 +02:00
Trevor Spiteri
48c7f3421a
silence unhelpful clippy::type_repetition_in_bounds
2019-08-14 16:00:57 +02:00
Trevor Spiteri
4a5333416b
use byte slices instead of str slices in from_str.rs
2019-08-14 14:00:14 +02:00
Trevor Spiteri
b98271c5fb
add comment and remove duplications for DecToBin
2019-08-14 13:25:33 +02:00
Trevor Spiteri
0e3ce95394
add comment on generating test strings in check_exact_decimal
2019-08-13 20:06:40 +02:00
Trevor Spiteri
e740a88547
very long decimal fraction strings are now parsed correctly
2019-08-13 19:01:01 +02:00
Trevor Spiteri
83ef24b241
use types::* instead of redefining them in tests in lib.rs
2019-08-12 16:56:16 +02:00
Trevor Spiteri
4db3c0c682
style: remove err! macro in from_str
2019-08-12 16:51:30 +02:00
Trevor Spiteri
ea84e11808
version 0.4.1
2019-08-12 14:25:51 +02:00
Trevor Spiteri
6fefffd383
use nbits, not dump_bits, as parameter in conversion fns in from_str
2019-08-12 14:23:07 +02:00
Trevor Spiteri
d58a2009e0
remove duplicate get_frac128/get_frac* code in from_str
2019-08-12 13:52:08 +02:00
Trevor Spiteri
0840c4fcf0
skip TryFrom doc test if TryFrom not supported by rustc
2019-08-12 13:16:50 +02:00
Trevor Spiteri
49eca656df
trim zeros in from_str::parse_bounds
2019-08-12 13:06:15 +02:00
Trevor Spiteri
f8196b89a1
add examples to traits::Fixed
2019-08-12 12:34:01 +02:00
Trevor Spiteri
3447c30260
tweak
2019-08-12 01:01:18 +02:00
Trevor Spiteri
63cfb09c1c
add some compile_fail tests for conversion to isize/usize
2019-08-11 21:48:55 +02:00
Trevor Spiteri
9b37782249
add some compile_fail tests
2019-08-11 21:42:50 +02:00
Trevor Spiteri
61418b3dc7
fix test compilation
2019-08-11 21:22:08 +02:00
Trevor Spiteri
d5c0de1f73
simplify conversion trait constraints
2019-08-11 21:08:15 +02:00
Trevor Spiteri
736c513d69
add types::LeEqU* to simplify Frac bounds
2019-08-11 21:08:05 +02:00
Trevor Spiteri
b97754dc5e
deprecate traits::Fixed::{mul,div,rem}_int, use {Mul,Div,Rem}
2019-08-11 12:13:39 +02:00
Trevor Spiteri
414e63a6dc
make it difficult to accidently leak supertraits in sealed traits
2019-08-11 11:23:15 +02:00
Trevor Spiteri
7695b680e3
multiplication-free radix 2, 4, 16 parsing of integer part
2019-08-11 00:09:54 +02:00
Trevor Spiteri
5efb6f4f85
fix some bugs and add some tests from from_str stuff
2019-08-10 22:06:41 +02:00
Trevor Spiteri
3a4a99a380
clippy
2019-08-10 20:37:23 +02:00
Trevor Spiteri
7d9f738b70
reduce comparisons in hex_str_to_bin
2019-08-10 20:34:29 +02:00
Trevor Spiteri
af02209c48
add from_str_{binary,octal,hex} to traits::Fixed
2019-08-10 19:14:15 +02:00
Trevor Spiteri
4187d84e41
add octal and hex
2019-08-10 19:07:57 +02:00
Trevor Spiteri
f8630a63f6
fix some bugs in from_str
2019-08-10 18:13:36 +02:00
Trevor Spiteri
9f881db399
implement from_str_bin
2019-08-10 16:46:44 +02:00
Trevor Spiteri
852040e876
simplify from_str and start adding support for 2, 8, 16 radixes
2019-08-10 15:34:49 +02:00
Trevor Spiteri
e6f64a44b2
optimize from_str when frac_nbits < nbits/2 or int_nbits < nbits/2
...
* get_frac128 will call get_frac64 if frac_nbits <= 64
* get_frac64 will call get_frac32 if frac_nbits <= 32
* get_frac32 will call get_frac16 if frac_nbits <= 16
* get_frac16 will call get_frac8 if frac_nbits <= 8
* get_frac8 has to do the work itself
* similar for get_int_{u128,u64,u32,u16}, get_int_{i128,i64,i32,i16}
2019-08-10 00:19:36 +02:00
Trevor Spiteri
9674a05d7f
expose ParseFixedError
2019-08-09 23:35:34 +02:00
Trevor Spiteri
76a8e07f54
use parse::<primitives> instead of naive multiply accumulate
2019-08-09 23:13:44 +02:00
Trevor Spiteri
5459750f6d
use parse::<u128> instead of naive multiply accumulate
2019-08-09 23:06:51 +02:00
Trevor Spiteri
1a9816486c
add FromStr supertrait to traits::Fixed
2019-08-09 22:38:09 +02:00
Trevor Spiteri
03b26d5675
implement FromStr for Fixed{I128,U128}
2019-08-09 22:34:13 +02:00
Trevor Spiteri
ae92706f1d
implement FromStr for Fixed{I32,U32,I64,U64}
2019-08-09 21:52:16 +02:00
Trevor Spiteri
34b14cd4e9
generatlize FromStr from Fixed{I8,U8} and do Fixed{I16,U16}
2019-08-09 21:04:36 +02:00