Struct matrix_sdk_crypto::requests::ToDeviceRequest
source · pub struct ToDeviceRequest {
pub event_type: ToDeviceEventType,
pub txn_id: OwnedTransactionId,
pub messages: BTreeMap<OwnedUserId, BTreeMap<DeviceIdOrAllDevices, Raw<AnyToDeviceEventContent>>>,
}
Expand description
Customized version of
ruma_client_api::to_device::send_event_to_device::v3::Request
Fields§
§event_type: ToDeviceEventType
Type of event being sent to each device.
txn_id: OwnedTransactionId
A request identifier unique to the access token used to send the request.
messages: BTreeMap<OwnedUserId, BTreeMap<DeviceIdOrAllDevices, Raw<AnyToDeviceEventContent>>>
A map of users to devices to a content for a message event to be
sent to the user’s device. Individual message events can be sent
to devices, but all events must be of the same type.
The content’s type for this field will be updated in a future
release, until then you can create a value using
serde_json::value::to_raw_value
.
Implementations§
source§impl ToDeviceRequest
impl ToDeviceRequest
sourcepub fn new(
recipient: &UserId,
recipient_device: impl Into<DeviceIdOrAllDevices>,
event_type: &str,
content: Raw<AnyToDeviceEventContent>,
) -> Self
pub fn new( recipient: &UserId, recipient_device: impl Into<DeviceIdOrAllDevices>, event_type: &str, content: Raw<AnyToDeviceEventContent>, ) -> Self
Create a new owned to-device request
§Arguments
-
recipient
- The ID of the user that should receive this to-device event. -
recipient_device
- The device that should receive this to-device event, or all devices. -
event_type
- The type of the event content that is getting sent out. -
content
- The content of the to-device event.
sourcepub fn message_count(&self) -> usize
pub fn message_count(&self) -> usize
Get the number of unique messages this request contains.
Note: A single message may be sent to multiple devices, so this may or may not be the number of devices that will receive the messages as well.
Trait Implementations§
source§impl Clone for ToDeviceRequest
impl Clone for ToDeviceRequest
source§fn clone(&self) -> ToDeviceRequest
fn clone(&self) -> ToDeviceRequest
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ToDeviceRequest
impl Debug for ToDeviceRequest
source§impl<'de> Deserialize<'de> for ToDeviceRequest
impl<'de> Deserialize<'de> for ToDeviceRequest
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl From<ToDeviceRequest> for OutgoingRequests
impl From<ToDeviceRequest> for OutgoingRequests
source§fn from(request: ToDeviceRequest) -> Self
fn from(request: ToDeviceRequest) -> Self
source§impl From<ToDeviceRequest> for OutgoingVerificationRequest
impl From<ToDeviceRequest> for OutgoingVerificationRequest
source§fn from(r: ToDeviceRequest) -> Self
fn from(r: ToDeviceRequest) -> Self
Auto Trait Implementations§
impl Freeze for ToDeviceRequest
impl RefUnwindSafe for ToDeviceRequest
impl Send for ToDeviceRequest
impl Sync for ToDeviceRequest
impl Unpin for ToDeviceRequest
impl UnwindSafe for ToDeviceRequest
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more