pub enum Delivery<'a> {
Draft {
channel: &'a dyn DraftChannel,
message_id: String,
},
Return,
}Expand description
Who is responsible for putting the final reply in front of the user.
Constructed once per turn and matched exhaustively at the end of it, so
“the caller gets the text” and “the channel already showed the text” are
two arms of one decision instead of two independent if statements that
can drift apart.
Variants§
Draft
A live draft message owns the reply; deliver edits it in place.
Return
Nobody has shown anything; deliver hands the text back to the caller.
Implementations§
Source§impl<'a> Delivery<'a>
impl<'a> Delivery<'a>
Sourcepub async fn open(
channel: &'a dyn Channel,
chat_id: &str,
placeholder: &str,
) -> Self
pub async fn open( channel: &'a dyn Channel, chat_id: &str, placeholder: &str, ) -> Self
Open a draft on channel if it supports drafts and the placeholder
send succeeds; otherwise the reply is returned to the caller.
Sourcepub fn draft(&self) -> Option<(&dyn DraftChannel, &str)>
pub fn draft(&self) -> Option<(&dyn DraftChannel, &str)>
The live draft, if one is open.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Delivery<'a>
impl<'a> !UnwindSafe for Delivery<'a>
impl<'a> Freeze for Delivery<'a>
impl<'a> Send for Delivery<'a>
impl<'a> Sync for Delivery<'a>
impl<'a> Unpin for Delivery<'a>
impl<'a> UnsafeUnpin for Delivery<'a>
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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>
Converts
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>
Converts
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