Struct prowl::Notification
source · [−]pub struct Notification { /* private fields */ }
Expand description
Creates a notification in memory to be sent via prowl.
Implementations
sourceimpl Notification
impl Notification
sourceimpl Notification
impl Notification
sourcepub fn new(
api_keys: Vec<String>,
priority: Option<Priority>,
url: Option<String>,
application: String,
event: String,
description: String
) -> Result<Self, CreationError>
pub fn new(
api_keys: Vec<String>,
priority: Option<Priority>,
url: Option<String>,
application: String,
event: String,
description: String
) -> Result<Self, CreationError>
Creates a new Notification
in memory that can be sent via add
.
Examples
Create a new notification and send it via add,
let application = "My fancy app".to_string();
let notification_title = "Meet Single Crabs in your Area!".to_string();
let notification_description = "Zero-cost abstractions are waiting for your to claim them!".to_string();
let notification = prowl::Notification::new(
vec!["MY-API-KEY".to_string()],
Some(prowl::Priority::VeryLow),
Some("http://rust-lang.org/".to_string()),
application,
notification_title,
notification_description,
)?;
sourcepub async fn add(&self) -> Result<(), AddError>
pub async fn add(&self) -> Result<(), AddError>
Send a notification to the Prowl API (and your devices).
Examples
Create a new notification and send it via add,
let application = "Mom".to_string();
let notification_title = "URGENT".to_string();
let notification_description = "We've been trying to reach you about your cars extended warrany".to_string();
let notification = prowl::Notification::new(
vec!["MY-API-KEY".to_string()],
None,
None,
application,
notification_title,
notification_description,
)?;
notification.add()?;
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Notification
impl Send for Notification
impl Sync for Notification
impl Unpin for Notification
impl UnwindSafe for Notification
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more