pub struct OsNotifier<C: OsNotifyChannel> {
channel: C,
settings: SettingsHandle,
}Expand description
Sends OS notifications when gating rules pass.
Fields§
§channel: C§settings: SettingsHandleImplementations§
Source§impl<C: OsNotifyChannel> OsNotifier<C>
impl<C: OsNotifyChannel> OsNotifier<C>
pub fn new(channel: C, settings: SettingsHandle) -> Self
Source§impl OsNotifier<NoopOsChannel>
impl OsNotifier<NoopOsChannel>
Sourcepub fn noop() -> Self
pub fn noop() -> Self
Create a no-op OsNotifier suitable for integration tests and CLI
contexts where no AppHandle is available.
OS notifications are silently discarded. The gating logic still runs
(it reads settings), but with a default SettingsHandle that has
notifications.os_enabled = false, so the channel is never called.
Source§impl<C: OsNotifyChannel> OsNotifier<C>
impl<C: OsNotifyChannel> OsNotifier<C>
Sourcepub async fn maybe_send(
&self,
notification: &Notification,
terminal: bool,
) -> Result<(), AppError>
pub async fn maybe_send( &self, notification: &Notification, terminal: bool, ) -> Result<(), AppError>
Conditionally send an OS notification.
Returns Ok(()) when any gate fails (silent skip).
Returns Err(AppError::Network { .. }) only if the plugin call itself
errors.
Auto Trait Implementations§
impl<C> Freeze for OsNotifier<C>where
C: Freeze,
impl<C> !RefUnwindSafe for OsNotifier<C>
impl<C> Send for OsNotifier<C>where
C: Send,
impl<C> Sync for OsNotifier<C>where
C: Sync,
impl<C> Unpin for OsNotifier<C>where
C: Unpin,
impl<C> UnsafeUnpin for OsNotifier<C>where
C: UnsafeUnpin,
impl<C> !UnwindSafe for OsNotifier<C>
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<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>
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 moreCreates a shared type from an unshared type.