pub struct SlackMessage {
pub text: String,
pub channel: Option<String>,
pub username: Option<String>,
pub icon_emoji: Option<String>,
pub icon_url: Option<String>,
pub attachments: Vec<SlackAttachment>,
}Expand description
A Slack message for webhook notifications.
Fields§
§text: StringMain message text.
channel: Option<String>Optional channel override.
username: Option<String>Optional username override.
icon_emoji: Option<String>Optional icon emoji (e.g., “:rocket:”).
icon_url: Option<String>Optional icon URL.
attachments: Vec<SlackAttachment>Message attachments.
Implementations§
Source§impl SlackMessage
impl SlackMessage
Sourcepub fn new(text: impl Into<String>) -> SlackMessage
pub fn new(text: impl Into<String>) -> SlackMessage
Create a new Slack message with text.
Sourcepub fn channel(self, channel: impl Into<String>) -> SlackMessage
pub fn channel(self, channel: impl Into<String>) -> SlackMessage
Set the channel.
Sourcepub fn username(self, username: impl Into<String>) -> SlackMessage
pub fn username(self, username: impl Into<String>) -> SlackMessage
Set the username.
Sourcepub fn icon_emoji(self, emoji: impl Into<String>) -> SlackMessage
pub fn icon_emoji(self, emoji: impl Into<String>) -> SlackMessage
Set the icon emoji.
Sourcepub fn icon_url(self, url: impl Into<String>) -> SlackMessage
pub fn icon_url(self, url: impl Into<String>) -> SlackMessage
Set the icon URL.
Sourcepub fn attachment(self, attachment: SlackAttachment) -> SlackMessage
pub fn attachment(self, attachment: SlackAttachment) -> SlackMessage
Add an attachment.
Trait Implementations§
Source§impl Clone for SlackMessage
impl Clone for SlackMessage
Source§fn clone(&self) -> SlackMessage
fn clone(&self) -> SlackMessage
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SlackMessage
impl Debug for SlackMessage
Source§impl Default for SlackMessage
impl Default for SlackMessage
Source§fn default() -> SlackMessage
fn default() -> SlackMessage
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for SlackMessage
impl<'de> Deserialize<'de> for SlackMessage
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SlackMessage, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SlackMessage, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for SlackMessage
impl Serialize for SlackMessage
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for SlackMessage
impl RefUnwindSafe for SlackMessage
impl Send for SlackMessage
impl Sync for SlackMessage
impl Unpin for SlackMessage
impl UnsafeUnpin for SlackMessage
impl UnwindSafe for SlackMessage
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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 more