@@ -44,7 +44,7 @@ use ruma::{
44
44
} ,
45
45
room_key:: ToDeviceRoomKeyEvent ,
46
46
secret:: request:: SecretName ,
47
- AnyMessageEventContent , AnyRoomEvent , AnyToDeviceEvent , EventContent ,
47
+ AnyRoomEvent , AnyToDeviceEvent , MessageEventContent ,
48
48
} ,
49
49
serde:: Raw ,
50
50
DeviceId , DeviceKeyAlgorithm , DeviceKeyId , EventEncryptionAlgorithm , RoomId , UInt , UserId ,
@@ -695,9 +695,6 @@ impl OlmMachine {
695
695
/// [`should_share_group_session`] method if a new group session needs to
696
696
/// be shared.
697
697
///
698
- /// **Note**: This method doesn't support encrypting custom events, see the
699
- /// [`encrypt_raw()`] method to do so.
700
- ///
701
698
/// # Arguments
702
699
///
703
700
/// * `room_id` - The id of the room for which the message should be
@@ -712,11 +709,10 @@ impl OlmMachine {
712
709
///
713
710
/// [`should_share_group_session`]: #method.should_share_group_session
714
711
/// [`share_group_session`]: #method.share_group_session
715
- /// [`encrypt_raw()`]: #method.encrypt_raw
716
712
pub async fn encrypt (
717
713
& self ,
718
714
room_id : & RoomId ,
719
- content : AnyMessageEventContent ,
715
+ content : impl MessageEventContent ,
720
716
) -> MegolmResult < RoomEncryptedEventContent > {
721
717
let event_type = content. event_type ( ) . to_owned ( ) ;
722
718
let content = serde_json:: to_value ( content) ?;
@@ -726,8 +722,8 @@ impl OlmMachine {
726
722
727
723
/// Encrypt a json [`Value`] content for the given room.
728
724
///
729
- /// This method is equivalent to the [`encrypt()`] method but allows custom
730
- /// events to be encrypted .
725
+ /// This method is equivalent to the [`encrypt()`] method but operates on an
726
+ /// arbitrary JSON value instead of strongly-typed event content struct .
731
727
///
732
728
/// # Arguments
733
729
///
0 commit comments