pub struct PendingNotification<'a, U, N> { /* private fields */ }Expand description
A multi-channel notification being assembled - build with to, add
channels with .database()/.mail(), run them with .send(). Each
channel method builds and immediately boxes its own delivery future
while its own bound (N: Notification, or N: MailNotification, U: MailNotifiable) is known, erasing it to a plain BoxedDelivery<'a>
before storing it - which is what lets .send() itself need no bound
on U/N at all, regardless of how many or which channels were
actually selected.
Implementations§
Source§impl<'a, U, N> PendingNotification<'a, U, N>
impl<'a, U, N> PendingNotification<'a, U, N>
Sourcepub fn database(self) -> PendingNotification<'a, U, N>where
U: Authenticatable,
N: Notification,
pub fn database(self) -> PendingNotification<'a, U, N>where
U: Authenticatable,
N: Notification,
Adds the database channel - Laravel’s toDatabase(), via
notify.
Sourcepub fn mail(self) -> PendingNotification<'a, U, N>where
U: MailNotifiable,
N: MailNotification,
pub fn mail(self) -> PendingNotification<'a, U, N>where
U: MailNotifiable,
N: MailNotification,
Adds the mail channel - Laravel’s toMail(), via
MailNotification::to_mail and [MailNotifiable:: notification_email]. The boxed future captures only the owned
email string and the owned Mail value it builds right away, not
a borrow of self - so its own Send-ness depends only on
MailNotification::Mail: Send, already required by that trait.
Sourcepub async fn send(self) -> Result<(), AppError>
pub async fn send(self) -> Result<(), AppError>
Runs every selected channel, in the order they were chosen,
sequentially - not concurrently the way notify_and_mail’s
fixed two channels are, since an arbitrary-length list of
channels has no single natural tokio::try_join!-style shape,
and sequential delivery keeps which channel a failure came from
unambiguous. No channel selected at all is logged and treated as
Ok(()), not a silent no-op left completely unremarked - the
same “nothing to do, but say so” posture elsewhere in this
framework reserves for a genuinely empty operation.
Auto Trait Implementations§
impl<'a, U, N> !RefUnwindSafe for PendingNotification<'a, U, N>
impl<'a, U, N> !Sync for PendingNotification<'a, U, N>
impl<'a, U, N> !UnwindSafe for PendingNotification<'a, U, N>
impl<'a, U, N> Forget for PendingNotification<'a, U, N>
impl<'a, U, N> Freeze for PendingNotification<'a, U, N>
impl<'a, U, N> Send for PendingNotification<'a, U, N>
impl<'a, U, N> Unpin for PendingNotification<'a, U, N>
impl<'a, U, N> UnsafeUnpin for PendingNotification<'a, U, N>
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
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> ⓘ
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