@@ -403,12 +403,12 @@ impl Room {
403
403
/// sliding sync.
404
404
#[ cfg( feature = "experimental-sliding-sync" ) ]
405
405
pub fn latest_event ( & self ) -> Option < LatestEvent > {
406
- self . inner . read ( ) . latest_event . clone ( )
406
+ self . inner . read ( ) . latest_event . as_deref ( ) . cloned ( )
407
407
}
408
408
409
409
/// Update the last event in the room
410
410
#[ cfg( all( feature = "e2e-encryption" , feature = "experimental-sliding-sync" ) ) ]
411
- pub ( crate ) fn set_latest_event ( & self , latest_event : Option < LatestEvent > ) {
411
+ pub ( crate ) fn set_latest_event ( & self , latest_event : Option < Box < LatestEvent > > ) {
412
412
self . inner . update ( |info| info. latest_event = latest_event) ;
413
413
}
414
414
@@ -429,7 +429,7 @@ impl Room {
429
429
/// Panics if index is not a valid index in the latest_encrypted_events
430
430
/// list.
431
431
#[ cfg( all( feature = "e2e-encryption" , feature = "experimental-sliding-sync" ) ) ]
432
- pub ( crate ) fn on_latest_event_decrypted ( & self , latest_event : LatestEvent , index : usize ) {
432
+ pub ( crate ) fn on_latest_event_decrypted ( & self , latest_event : Box < LatestEvent > , index : usize ) {
433
433
self . set_latest_event ( Some ( latest_event) ) ;
434
434
self . latest_encrypted_events . write ( ) . unwrap ( ) . drain ( 0 ..=index) ;
435
435
}
@@ -732,10 +732,10 @@ pub struct RoomInfo {
732
732
pub ( crate ) encryption_state_synced : bool ,
733
733
/// The last event send by sliding sync
734
734
#[ cfg( feature = "experimental-sliding-sync" ) ]
735
- pub ( crate ) latest_event : Option < LatestEvent > ,
735
+ pub ( crate ) latest_event : Option < Box < LatestEvent > > ,
736
736
/// Base room info which holds some basic event contents important for the
737
737
/// room state.
738
- pub ( crate ) base_info : BaseRoomInfo ,
738
+ pub ( crate ) base_info : Box < BaseRoomInfo > ,
739
739
}
740
740
741
741
#[ derive( Clone , Debug , Serialize , Deserialize , PartialEq , Eq ) ]
@@ -769,7 +769,7 @@ impl RoomInfo {
769
769
encryption_state_synced : false ,
770
770
#[ cfg( feature = "experimental-sliding-sync" ) ]
771
771
latest_event : None ,
772
- base_info : BaseRoomInfo :: new ( ) ,
772
+ base_info : Box :: new ( BaseRoomInfo :: new ( ) ) ,
773
773
}
774
774
}
775
775
@@ -1246,10 +1246,10 @@ mod tests {
1246
1246
last_prev_batch : Some ( "pb" . to_owned ( ) ) ,
1247
1247
sync_info : SyncInfo :: FullySynced ,
1248
1248
encryption_state_synced : true ,
1249
- latest_event : Some ( LatestEvent :: new (
1249
+ latest_event : Some ( Box :: new ( LatestEvent :: new (
1250
1250
Raw :: from_json_string ( json ! ( { "sender" : "@u:i.uk" } ) . to_string ( ) ) . unwrap ( ) . into ( ) ,
1251
- ) ) ,
1252
- base_info : BaseRoomInfo :: new ( ) ,
1251
+ ) ) ) ,
1252
+ base_info : Box :: new ( BaseRoomInfo :: new ( ) ) ,
1253
1253
} ;
1254
1254
1255
1255
let info_json = json ! ( {
@@ -1698,10 +1698,10 @@ mod tests {
1698
1698
}
1699
1699
1700
1700
#[ cfg( feature = "experimental-sliding-sync" ) ]
1701
- fn make_latest_event ( event_id : & str ) -> LatestEvent {
1702
- LatestEvent :: new ( SyncTimelineEvent :: new (
1701
+ fn make_latest_event ( event_id : & str ) -> Box < LatestEvent > {
1702
+ Box :: new ( LatestEvent :: new ( SyncTimelineEvent :: new (
1703
1703
Raw :: from_json_string ( json ! ( { "event_id" : event_id } ) . to_string ( ) ) . unwrap ( ) ,
1704
- ) )
1704
+ ) ) )
1705
1705
}
1706
1706
1707
1707
fn timestamp ( minutes_ago : u32 ) -> MilliSecondsSinceUnixEpoch {
0 commit comments