pub struct SendHandle {
pub created_at: MilliSecondsSinceUnixEpoch,
/* private fields */
}Expand description
A handle to manipulate an event that was scheduled to be sent to a room.
The event may be a room message, a media upload, a redaction or a reaction;
Self::edit and Self::react only apply to the first two, and return
false/None for the others.
Fields§
§created_at: MilliSecondsSinceUnixEpochThe time at which the event to be sent has been created.
Implementations§
Source§impl SendHandle
impl SendHandle
Sourcepub fn transaction_id(&self) -> &TransactionId
pub fn transaction_id(&self) -> &TransactionId
Returns the TransactionId used for sending the associated event.
Sourcepub async fn abort(&self) -> Result<bool, RoomSendQueueStorageError>
pub async fn abort(&self) -> Result<bool, RoomSendQueueStorageError>
Aborts the sending of the event, if it wasn’t sent yet.
Returns true if the sending could be aborted, false if not (i.e. the event had already been sent).
Sourcepub async fn abort_with_reason(
&self,
reason: Option<String>,
) -> Result<bool, RoomSendQueueStorageError>
pub async fn abort_with_reason( &self, reason: Option<String>, ) -> Result<bool, RoomSendQueueStorageError>
Aborts the sending of the event, if it wasn’t sent yet, with an optional reason.
If the event was being sent when the abort was requested and the send succeeds, the event is redacted server-side; the given reason is applied to that redaction. It is unused in every other case (the local echo is simply dropped).
Returns true if the sending could be aborted, false if not (i.e. the event had already been sent).
Sourcepub async fn edit_raw(
&self,
new_content: Raw<AnyMessageLikeEventContent>,
event_type: String,
) -> Result<bool, RoomSendQueueStorageError>
pub async fn edit_raw( &self, new_content: Raw<AnyMessageLikeEventContent>, event_type: String, ) -> Result<bool, RoomSendQueueStorageError>
Edits the content of a local echo with a raw event content.
Returns true if the event to be sent was replaced, false if not (i.e. the event had already been sent).
This method should not be used for editing sticky events. Sticky events
are collected in an ephemeral map. Entries in that map need to be
updated by sending a replacing sticky event with updated content,
not by using an m.replace relation. Nevertheless, this method
applies edits of an unsent sticky event on the queued event
directly because it is safe to do so. If, however, the event has
already been sent, the edit will be sent as an unsticky event.
Sourcepub async fn edit(
&self,
new_content: AnyMessageLikeEventContent,
) -> Result<bool, RoomSendQueueStorageError>
pub async fn edit( &self, new_content: AnyMessageLikeEventContent, ) -> Result<bool, RoomSendQueueStorageError>
Edits the content of a local echo with an event content.
Returns true if the event to be sent was replaced, false if not (i.e. the event had already been sent).
This method should not be used for editing sticky events. Sticky events
are collected in an ephemeral map. Entries in that map need to be
updated by sending a replacing sticky event with updated content,
not by using an m.replace relation. Nevertheless, this method
applies edits of an unsent sticky event on the queued event
directly because it is safe to do so. If, however, the event has
already been sent, the edit will be sent as an unsticky event.
Sourcepub async fn edit_media_caption(
&self,
caption: Option<String>,
formatted_caption: Option<FormattedBody>,
mentions: Option<Mentions>,
) -> Result<bool, RoomSendQueueStorageError>
pub async fn edit_media_caption( &self, caption: Option<String>, formatted_caption: Option<FormattedBody>, mentions: Option<Mentions>, ) -> Result<bool, RoomSendQueueStorageError>
Edits the content of a local echo with a media caption.
Will fail if the event to be sent, represented by this send handle, wasn’t a media.
Sourcepub async fn unwedge(&self) -> Result<(), RoomSendQueueError>
pub async fn unwedge(&self) -> Result<(), RoomSendQueueError>
Unwedge the local echo associated to this SendHandle and try to
resend it.
Sourcepub async fn react(
&self,
key: String,
) -> Result<Option<SendHandle>, RoomSendQueueStorageError>
pub async fn react( &self, key: String, ) -> Result<Option<SendHandle>, RoomSendQueueStorageError>
Send a reaction to the event as soon as it’s sent.
If returning Ok(None); this means the reaction couldn’t be sent
because the event is already a remote one.
Trait Implementations§
Source§impl Clone for SendHandle
impl Clone for SendHandle
Source§fn clone(&self) -> SendHandle
fn clone(&self) -> SendHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for SendHandle
impl !UnwindSafe for SendHandle
impl Freeze for SendHandle
impl Send for SendHandle
impl Sync for SendHandle
impl Unpin for SendHandle
impl UnsafeUnpin for SendHandle
Blanket Implementations§
impl<T> Any for Twhere
T: Any,
impl<T> AsyncTraitDeps for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> CloneAny for T
impl<T> CloneAnySend for T
impl<T> CloneAnySendSync for T
impl<T> CloneAnySync for 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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> DropFlavorWrapper<T> for T
impl<T> DropFlavorWrapper<T> for T
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> Fruit for T
Source§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
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