@@ -36,29 +36,27 @@ use crate::util::{
3636
3737/// Rust representation for logical type INT96, value is backed by an array of `u32`.
3838/// The type only takes 12 bytes, without extra padding.
39- #[ derive( Clone , Debug , PartialOrd , Default ) ]
39+ #[ derive( Clone , Debug , PartialOrd , Default , PartialEq , Eq ) ]
4040pub struct Int96 {
41- value : Option < [ u32 ; 3 ] > ,
41+ value : [ u32 ; 3 ] ,
4242}
4343
4444impl Int96 {
4545 /// Creates new INT96 type struct with no data set.
4646 pub fn new ( ) -> Self {
47- Self { value : None }
47+ Self { value : [ 0 ; 3 ] }
4848 }
4949
5050 /// Returns underlying data as slice of [`u32`].
5151 #[ inline]
5252 pub fn data ( & self ) -> & [ u32 ] {
53- self . value
54- . as_ref ( )
55- . expect ( "set_data should have been called" )
53+ & self . value
5654 }
5755
5856 /// Sets data for this INT96 type.
5957 #[ inline]
6058 pub fn set_data ( & mut self , elem0 : u32 , elem1 : u32 , elem2 : u32 ) {
61- self . value = Some ( [ elem0, elem1, elem2] ) ;
59+ self . value = [ elem0, elem1, elem2] ;
6260 }
6361
6462 /// Converts this INT96 into an i64 representing the number of MILLISECONDS since Epoch
@@ -75,16 +73,6 @@ impl Int96 {
7573 }
7674}
7775
78- impl PartialEq for Int96 {
79- fn eq ( & self , other : & Int96 ) -> bool {
80- match ( & self . value , & other. value ) {
81- ( Some ( v1) , Some ( v2) ) => v1 == v2,
82- ( None , None ) => true ,
83- _ => false ,
84- }
85- }
86- }
87-
8876impl From < Vec < u32 > > for Int96 {
8977 fn from ( buf : Vec < u32 > ) -> Self {
9078 assert_eq ! ( buf. len( ) , 3 ) ;
0 commit comments