Skip to main content

PendingNotification

Struct PendingNotification 

Source
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>

Source

pub fn database(self) -> PendingNotification<'a, U, N>

Adds the database channel - Laravel’s toDatabase(), via notify.

Source

pub fn mail(self) -> PendingNotification<'a, U, N>

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.

Source

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> Freeze for PendingNotification<'a, U, N>

§

impl<'a, U, N> Send for PendingNotification<'a, U, N>
where &'a U: Send, &'a N: Send,

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more