pub struct Plan { /* private fields */ }Expand description
Plan block representation.
§Fields and Validations
For more details, see the official documentation.
| Field | Type | Required | Validation |
|---|---|---|---|
| title | String | Yes | N/A |
| block_id | String | No | Maximum 255 characters |
| tasks | Vec<TaskCard> | No | N/A |
§Example
use slack_messaging::blocks::{Plan, RichText, TaskCard, TaskStatus};
use slack_messaging::blocks::rich_text::RichTextSection;
use slack_messaging::blocks::rich_text::types::RichTextElementText;
let plan = Plan::builder()
.title("Thinking completed")
.task(
TaskCard::builder()
.task_id("call_001")
.title("Fetched user profile information")
.status(TaskStatus::InProgress)
.details(
RichText::builder()
.block_id("viMWO")
.element(
RichTextSection::builder()
.element(
RichTextElementText::builder()
.text("Searched database...")
.build()?
)
.build()?
)
.build()?
)
.output(
RichText::builder()
.block_id("viMWO")
.element(
RichTextSection::builder()
.element(
RichTextElementText::builder()
.text("Profile data loaded")
.build()?
)
.build()?
)
.build()?
)
.build()?
)
.task(
TaskCard::builder()
.task_id("call_002")
.title("Checked user permissions")
.status(TaskStatus::Pending)
.build()?
)
.task(
TaskCard::builder()
.task_id("call_003")
.title("Generated comprehensive user report")
.status(TaskStatus::Complete)
.output(
RichText::builder()
.block_id("crsk")
.element(
RichTextSection::builder()
.element(
RichTextElementText::builder()
.text("15 data points compiled")
.build()?
)
.build()?
)
.build()?
)
.build()?
)
.build()?;
let expected = serde_json::json!({
"type": "plan",
"title": "Thinking completed",
"tasks": [
{
"type": "task_card",
"task_id": "call_001",
"title": "Fetched user profile information",
"status": "in_progress",
"details": {
"type": "rich_text",
"block_id": "viMWO",
"elements": [
{
"type": "rich_text_section",
"elements": [
{
"type": "text",
"text": "Searched database..."
}
]
}
]
},
"output": {
"type": "rich_text",
"block_id": "viMWO",
"elements": [
{
"type": "rich_text_section",
"elements": [
{
"type": "text",
"text": "Profile data loaded"
}
]
}
]
}
},
{
"type": "task_card",
"task_id": "call_002",
"title": "Checked user permissions",
"status": "pending"
},
{
"type": "task_card",
"task_id": "call_003",
"title": "Generated comprehensive user report",
"status": "complete",
"output": {
"type": "rich_text",
"block_id": "crsk",
"elements": [
{
"type": "rich_text_section",
"elements": [
{
"type": "text",
"text": "15 data points compiled"
}
]
}
]
}
}
]
});
let json = serde_json::to_value(plan).unwrap();
assert_eq!(json, expected);Implementations§
Source§impl Plan
impl Plan
Sourcepub fn builder() -> PlanBuilder
pub fn builder() -> PlanBuilder
constract PlanBuilder object.
Trait Implementations§
impl StructuralPartialEq for Plan
Auto Trait Implementations§
impl Freeze for Plan
impl RefUnwindSafe for Plan
impl Send for Plan
impl Sync for Plan
impl Unpin for Plan
impl UnsafeUnpin for Plan
impl UnwindSafe for Plan
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