2929
3030mod parse;
3131
32+ #[ cfg( feature = "arbitrary" ) ]
33+ extern crate arbitrary;
3234#[ cfg( feature = "serde" ) ]
3335extern crate serde;
3436#[ cfg( feature = "serde" ) ]
@@ -110,6 +112,7 @@ pub fn pib<V: Into<u64>>(size: V) -> u64 {
110112
111113/// Byte size representation
112114#[ derive( Copy , Clone , PartialEq , PartialOrd , Eq , Ord , Hash , Default ) ]
115+ #[ cfg_attr( feature = "arbitrary" , derive( arbitrary:: Arbitrary ) ) ]
113116pub struct ByteSize ( pub u64 ) ;
114117
115118impl ByteSize {
@@ -208,7 +211,7 @@ pub fn to_string(bytes: u64, si_prefix: bool) -> String {
208211}
209212
210213impl Display for ByteSize {
211- fn fmt ( & self , f : & mut Formatter ) ->fmt:: Result {
214+ fn fmt ( & self , f : & mut Formatter ) -> fmt:: Result {
212215 f. pad ( & to_string ( self . 0 , false ) )
213216 }
214217}
@@ -261,7 +264,9 @@ impl AddAssign<ByteSize> for ByteSize {
261264}
262265
263266impl < T > Add < T > for ByteSize
264- where T : Into < u64 > {
267+ where
268+ T : Into < u64 > ,
269+ {
265270 type Output = ByteSize ;
266271 #[ inline( always) ]
267272 fn add ( self , rhs : T ) -> ByteSize {
@@ -270,15 +275,19 @@ impl<T> Add<T> for ByteSize
270275}
271276
272277impl < T > AddAssign < T > for ByteSize
273- where T : Into < u64 > {
278+ where
279+ T : Into < u64 > ,
280+ {
274281 #[ inline( always) ]
275282 fn add_assign ( & mut self , rhs : T ) {
276283 self . 0 += rhs. into ( ) as u64 ;
277284 }
278285}
279286
280287impl < T > Mul < T > for ByteSize
281- where T : Into < u64 > {
288+ where
289+ T : Into < u64 > ,
290+ {
282291 type Output = ByteSize ;
283292 #[ inline( always) ]
284293 fn mul ( self , rhs : T ) -> ByteSize {
@@ -287,7 +296,9 @@ impl<T> Mul<T> for ByteSize
287296}
288297
289298impl < T > MulAssign < T > for ByteSize
290- where T : Into < u64 > {
299+ where
300+ T : Into < u64 > ,
301+ {
291302 #[ inline( always) ]
292303 fn mul_assign ( & mut self , rhs : T ) {
293304 self . 0 *= rhs. into ( ) as u64 ;
0 commit comments