@@ -395,15 +395,12 @@ impl Default for DataRevision {
395395
396396impl ToKey for DataRevision {
397397 fn to_key ( & self ) -> native_db:: Key {
398- native_db:: Key :: new (
399- match self {
400- DataRevision :: Latest ( v) => * v,
401- // Previous values are stored as negative so we can tell the difference
402- DataRevision :: Previous ( v) => -v,
403- }
404- . to_be_bytes ( )
405- . to_vec ( ) ,
406- )
398+ match self {
399+ DataRevision :: Latest ( v) => * v,
400+ // Previous values are stored as negative so we can tell the difference
401+ DataRevision :: Previous ( v) => -v,
402+ }
403+ . to_key ( )
407404 }
408405
409406 fn key_names ( ) -> Vec < String > {
@@ -428,7 +425,7 @@ impl Default for DataExpiration {
428425
429426impl ToKey for DataExpiration {
430427 fn to_key ( & self ) -> native_db:: Key {
431- native_db :: Key :: new ( self . 0 . timestamp_millis ( ) . to_be_bytes ( ) . to_vec ( ) )
428+ self . 0 . timestamp_millis ( ) . to_key ( )
432429 }
433430
434431 fn key_names ( ) -> Vec < String > {
@@ -457,7 +454,7 @@ impl Default for DataCreation {
457454
458455impl ToKey for DataCreation {
459456 fn to_key ( & self ) -> native_db:: Key {
460- native_db :: Key :: new ( self . 0 . timestamp_millis ( ) . to_be_bytes ( ) . to_vec ( ) )
457+ self . 0 . timestamp_millis ( ) . to_key ( )
461458 }
462459
463460 fn key_names ( ) -> Vec < String > {
@@ -650,7 +647,7 @@ mod test_resident {
650647 #[ tokio:: test]
651648 #[ test_log:: test]
652649 async fn test_temporal_data ( ) -> Result < ( ) > {
653- let database = test_db ! ( TestData ) ;
650+ let database = test_db ! ( TestHistoryData ) ;
654651
655652 let db = database. realm ( RealmName :: default ( ) ) . await ?;
656653 let res: Resident < TestHistoryData > = db. resident ( ( ) ) ?;
@@ -673,8 +670,6 @@ mod test_resident {
673670
674671 // Check history
675672 {
676- trace ! ( "{:?}" , DataCreation :: all( ) . start_bound( ) ) ;
677- trace ! ( "{:?}" , DataCreation :: all( ) . end_bound( ) ) ;
678673 assert_eq ! ( res. history( DataCreation :: all( ) ) . await ?. len( ) , 10 ) ;
679674 }
680675
@@ -790,6 +785,10 @@ impl<T: Data> ResidentVec<T> {
790785 pub async fn iter ( & self ) -> IntoValues < DataIdentifier , Resident < T > > {
791786 self . inner . read ( ) . await . clone ( ) . into_values ( )
792787 }
788+
789+ pub async fn stream ( & self ) -> futures:: stream:: Iter < IntoValues < DataIdentifier , Resident < T > > > {
790+ futures:: stream:: iter ( self . inner . read ( ) . await . clone ( ) . into_values ( ) )
791+ }
793792}
794793
795794#[ derive( Clone ) ]
0 commit comments