Struct nustify::Builder [−][src]
pub struct Builder(_);
A builder helper used to create a simple notification or a more complex one (link, image).
Implementations
impl Builder
[src]
impl Builder
[src]pub fn new(message: String) -> Self
[src]
Create a builder that will resolve to a notification with the provided content and an empty title.
pub fn title(self, title: String) -> Self
[src]
Set the title of the notification.
Examples
let notification = Builder::new("Rusty content".to_owned()) .title("Hello from Rust".to_owned()) .build();
pub fn extra(self, extra: String) -> Self
[src]
Set the value3
of the notification.
Examples
let notification = Builder::new("Rusty content".to_owned()) .extra("https://i.imgur.com/SFmiPRo.png".to_owned()) .build();
pub fn image_url(self, url: String) -> Self
[src]
Set the image URL of the notification (same as calling extra
).
Examples
let notification = Builder::new("Rusty content".to_owned()) .image_url("https://i.imgur.com/SFmiPRo.png".to_owned()) .build();
pub fn url(self, url: String) -> Self
[src]
Set the link that the notification will follow when tapped (same as calling extra
).
Examples
let notification = Builder::new("Rusty content".to_owned()) .url("https://www.rust-lang.org".to_owned()) .build();
pub async fn imgur_image<T>(
self,
client_id: &str,
image: T
) -> Result<Self, Error> where
T: Into<Cow<'static, [u8]>>,
[src]
self,
client_id: &str,
image: T
) -> Result<Self, Error> where
T: Into<Cow<'static, [u8]>>,
Upload an image to Imgur and use the URL returned by the API as the image URL.
Examples
let image_data = std::fs::read("crab.png")?; let notification = Builder::new("A nice uploaded image".to_owned()) .imgur_image("MY_IMGUR_KEY", image_data).await? .build();
Features
This method requires the imgur
feature.
pub fn build(self) -> Notification
[src]
Build the notification using all the settings previously provided.
Auto Trait Implementations
impl RefUnwindSafe for Builder
impl RefUnwindSafe for Builder
impl UnwindSafe for Builder
impl UnwindSafe for Builder
Blanket Implementations
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]