pub struct DispatchActionConfiguration { /* private fields */ }Expand description
Dispatch action configuration representation.
Example
use slack_messaging::blocks::elements::{DispatchActionConfiguration, TriggerAction};
use serde_json::json;
let config = DispatchActionConfiguration::new()
.push_trigger_action(TriggerAction::OnEnterPressed)
.push_trigger_action(TriggerAction::OnCharacterEntered);
let expected = json!({
"trigger_actions_on": [
"on_enter_pressed",
"on_character_entered"
]
});
let config_json = serde_json::to_value(config).unwrap();
assert_eq!(config_json, expected);Implementations§
source§impl DispatchActionConfiguration
impl DispatchActionConfiguration
sourcepub fn new() -> Self
pub fn new() -> Self
Constructs a Dispatch action configuration.
use slack_messaging::blocks::elements::DispatchActionConfiguration;
use serde_json::json;
let config = DispatchActionConfiguration::new();
let expected = json!({
"trigger_actions_on": []
});
let config_json = serde_json::to_value(config).unwrap();
assert_eq!(config_json, expected);sourcepub fn set_trigger_actions(self, actions: Vec<TriggerAction>) -> Self
pub fn set_trigger_actions(self, actions: Vec<TriggerAction>) -> Self
Sets trigger_actions_on field directly.
use slack_messaging::blocks::elements::{DispatchActionConfiguration, TriggerAction};
use serde_json::json;
let config = DispatchActionConfiguration::new()
.set_trigger_actions(
vec![
TriggerAction::OnEnterPressed,
TriggerAction::OnCharacterEntered,
]
);
let expected = json!({
"trigger_actions_on": [
"on_enter_pressed",
"on_character_entered"
]
});
let config_json = serde_json::to_value(config).unwrap();
assert_eq!(config_json, expected);sourcepub fn push_trigger_action(self, action: TriggerAction) -> Self
pub fn push_trigger_action(self, action: TriggerAction) -> Self
Adds trigger_action to trigger_actions_on field.
use slack_messaging::blocks::elements::{DispatchActionConfiguration, TriggerAction};
use serde_json::json;
let config = DispatchActionConfiguration::new()
.push_trigger_action(TriggerAction::OnEnterPressed);
let expected = json!({
"trigger_actions_on": [
"on_enter_pressed"
]
});
let config_json = serde_json::to_value(config).unwrap();
assert_eq!(config_json, expected);Trait Implementations§
source§impl Clone for DispatchActionConfiguration
impl Clone for DispatchActionConfiguration
source§fn clone(&self) -> DispatchActionConfiguration
fn clone(&self) -> DispatchActionConfiguration
Returns a copy 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 DispatchActionConfiguration
impl Debug for DispatchActionConfiguration
source§impl Default for DispatchActionConfiguration
impl Default for DispatchActionConfiguration
source§fn default() -> DispatchActionConfiguration
fn default() -> DispatchActionConfiguration
Returns the “default value” for a type. Read more