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 AnyOutgoingRequest
impl From<ToDeviceRequest> for AnyOutgoingRequest
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,
§impl<T> CompatExt for T
impl<T> CompatExt for T
Source§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
Source§fn consume_handle(handle: Handle) -> Arc<T>
fn consume_handle(handle: Handle) -> Arc<T>
Arc<>
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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