pub struct Alert { /* private fields */ }Expand description
Alert block representation.
§Fields and Validations
For more details, see the official documentation.
| Field | Type | Required | Validation |
|---|---|---|---|
| text | TextContent | Yes | N/A |
| level | AlertLevel | No | N/A |
| block_id | String | No | Maximum 255 characters |
§Example
use slack_messaging::blocks::{Alert, AlertLevel};
use slack_messaging::mrkdwn;
let alert = Alert::builder()
.text(mrkdwn!("The work is mysterious and important.")?)
.level(AlertLevel::Info)
.build()?;
let expected = serde_json::json!({
"type": "alert",
"text": {
"type": "mrkdwn",
"text": "The work is mysterious and important."
},
"level": "info"
});
let json = serde_json::to_value(alert).unwrap();
assert_eq!(json, expected);Implementations§
Source§impl Alert
impl Alert
Sourcepub fn builder() -> AlertBuilder
pub fn builder() -> AlertBuilder
constract AlertBuilder object.
Trait Implementations§
impl StructuralPartialEq for Alert
Auto Trait Implementations§
impl Freeze for Alert
impl RefUnwindSafe for Alert
impl Send for Alert
impl Sync for Alert
impl Unpin for Alert
impl UnsafeUnpin for Alert
impl UnwindSafe for Alert
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