File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11[package ]
22name = " msgpacker"
3- version = " 0.1.5 "
3+ version = " 0.1.6 "
44authors = [" Victor Lopez <victor@codx.io>" ]
55categories = [" compression" , " encoding" , " parser-implementations" ]
66edition = " 2021"
Original file line number Diff line number Diff line change @@ -36,6 +36,22 @@ impl Integer {
3636 Self :: Int64 ( n. into ( ) )
3737 }
3838
39+ /// Return either a raw i64 or a cast u64
40+ pub const fn as_signed ( & self ) -> i64 {
41+ match self {
42+ Self :: Uint64 ( i) => * i as i64 ,
43+ Self :: Int64 ( i) => * i,
44+ }
45+ }
46+
47+ /// Return either a raw u64 or a cast i64
48+ pub const fn as_unsigned ( & self ) -> u64 {
49+ match self {
50+ Self :: Uint64 ( i) => * i,
51+ Self :: Int64 ( i) => * i as u64 ,
52+ }
53+ }
54+
3955 /// Return the underlying u64, if the number if unsigned
4056 pub const fn as_u64 ( & self ) -> Option < u64 > {
4157 match self {
You can’t perform that action at this time.
0 commit comments