pub struct FeedbackButtons { /* private fields */ }Expand description
Feedback buttons element representation.
§Fields and Validations
For more details, see the official documentation.
| Field | Type | Required | Validation |
|---|---|---|---|
| action_id | String | No | Max length 255 characters |
| positive_button | FeedbackButton | Yes | N/A |
| negative_button | FeedbackButton | Yes | N/A |
§Example
use slack_messaging::plain_text;
use slack_messaging::blocks::elements::{types::FeedbackButton, FeedbackButtons};
let buttons = FeedbackButtons::builder()
.action_id("feedback_buttons_1")
.positive_button(
FeedbackButton::builder()
.text(plain_text!("Good")?)
.value("positive_feedback")
.accessibility_label("Mark this response as good")
.build()?
)
.negative_button(
FeedbackButton::builder()
.text(plain_text!("Bad")?)
.value("negative_feedback")
.accessibility_label("Mark this response as bad")
.build()?
)
.build()?;
let expected = serde_json::json!({
"type": "feedback_buttons",
"action_id": "feedback_buttons_1",
"positive_button": {
"text": {
"type": "plain_text",
"text": "Good"
},
"value": "positive_feedback",
"accessibility_label": "Mark this response as good"
},
"negative_button": {
"text": {
"type": "plain_text",
"text": "Bad"
},
"value": "negative_feedback",
"accessibility_label": "Mark this response as bad"
}
});
let json = serde_json::to_value(buttons).unwrap();
assert_eq!(json, expected);
// If your object has any validation errors, the build method returns Result::Err
let buttons = FeedbackButtons::builder()
.positive_button(
FeedbackButton::builder()
.text(plain_text!("Good")?)
.value("positive_feedback")
.accessibility_label("Mark this response as good")
.build()?
)
.build();
assert!(buttons.is_err());Implementations§
Source§impl FeedbackButtons
impl FeedbackButtons
Sourcepub fn builder() -> FeedbackButtonsBuilder
pub fn builder() -> FeedbackButtonsBuilder
constract FeedbackButtonsBuilder object.
Trait Implementations§
Source§impl Clone for FeedbackButtons
impl Clone for FeedbackButtons
Source§fn clone(&self) -> FeedbackButtons
fn clone(&self) -> FeedbackButtons
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 FeedbackButtons
impl Debug for FeedbackButtons
Source§impl From<FeedbackButtons> for ContextActionsElement
impl From<FeedbackButtons> for ContextActionsElement
Source§fn from(value: FeedbackButtons) -> Self
fn from(value: FeedbackButtons) -> Self
Converts to this type from the input type.
Source§impl PartialEq for FeedbackButtons
impl PartialEq for FeedbackButtons
Source§fn eq(&self, other: &FeedbackButtons) -> bool
fn eq(&self, other: &FeedbackButtons) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for FeedbackButtons
impl Serialize for FeedbackButtons
impl StructuralPartialEq for FeedbackButtons
Auto Trait Implementations§
impl Freeze for FeedbackButtons
impl RefUnwindSafe for FeedbackButtons
impl Send for FeedbackButtons
impl Sync for FeedbackButtons
impl Unpin for FeedbackButtons
impl UnsafeUnpin for FeedbackButtons
impl UnwindSafe for FeedbackButtons
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