@@ -153,7 +153,7 @@ use crate::{
153
153
media:: { MediaFormat , MediaRequestParameters } ,
154
154
notification_settings:: { IsEncrypted , IsOneToOne , RoomNotificationMode } ,
155
155
room:: {
156
- futures:: SendStateEventRaw ,
156
+ futures:: { SendStateEvent , SendStateEventRaw } ,
157
157
knock_requests:: { KnockRequest , KnockRequestMemberInfo } ,
158
158
power_levels:: { RoomPowerLevelChanges , RoomPowerLevelsExt } ,
159
159
privacy_settings:: RoomPrivacySettings ,
@@ -2647,11 +2647,11 @@ impl Room {
2647
2647
/// # anyhow::Ok(()) };
2648
2648
/// ```
2649
2649
#[ instrument( skip_all) ]
2650
- pub async fn send_state_event (
2651
- & self ,
2650
+ pub fn send_state_event < ' a > (
2651
+ & ' a self ,
2652
2652
content : impl StateEventContent < StateKey = EmptyStateKey > ,
2653
- ) -> Result < send_state_event :: v3 :: Response > {
2654
- self . send_state_event_for_key ( & EmptyStateKey , content) . await
2653
+ ) -> SendStateEvent < ' a > {
2654
+ self . send_state_event_for_key ( & EmptyStateKey , content)
2655
2655
}
2656
2656
2657
2657
/// Send a state event to the homeserver.
@@ -2694,21 +2694,17 @@ impl Room {
2694
2694
/// joined_room.send_state_event_for_key("foo", content).await?;
2695
2695
/// # anyhow::Ok(()) };
2696
2696
/// ```
2697
- pub async fn send_state_event_for_key < C , K > (
2698
- & self ,
2697
+ pub fn send_state_event_for_key < ' a , C , K > (
2698
+ & ' a self ,
2699
2699
state_key : & K ,
2700
2700
content : C ,
2701
- ) -> Result < send_state_event :: v3 :: Response >
2701
+ ) -> SendStateEvent < ' a >
2702
2702
where
2703
2703
C : StateEventContent ,
2704
2704
C :: StateKey : Borrow < K > ,
2705
2705
K : AsRef < str > + ?Sized ,
2706
2706
{
2707
- self . ensure_room_joined ( ) ?;
2708
- let request =
2709
- send_state_event:: v3:: Request :: new ( self . room_id ( ) . to_owned ( ) , state_key, & content) ?;
2710
- let response = self . client . send ( request) . await ?;
2711
- Ok ( response)
2707
+ SendStateEvent :: new ( self , state_key, content)
2712
2708
}
2713
2709
2714
2710
/// Send a raw room state event to the homeserver.
0 commit comments