Struct slack_blocks::elems::date_picker::build::DatePickerBuilder[][src]

pub struct DatePickerBuilder<'a, A> { /* fields omitted */ }
Expand description

Date Picker builder

Allows you to construct safely, with compile-time checks on required setter methods.

Required Methods

DatePickerBuilder::build() is only available if these methods have been called:

  • action_id

Example

use std::convert::TryFrom;

use slack_blocks::{blocks::{Actions, Block},
                   elems::{BlockElement, DatePicker}};

let picker = DatePicker::builder().action_id("foo").build();

let block: Block = Actions::builder().element(picker).build().into();

// <send block to slack API>

Implementations

Create a new builder

Set action_id (Optional)

An identifier for the action triggered when a menu option is selected.

You can use this when you receive an interaction payload to identify the source of the action 🔗.

Should be unique among all other action_ids in the containing block.

Maximum length for this field is 255 characters.

Set placeholder (Optional)

A plain_text only text object 🔗 that defines the placeholder text shown on the datepicker.

Maximum length for the text in this field is 150 characters.

Set initial_date (Optional)

The initial date that is selected when the element is loaded.

use slack_blocks::elems::DatePicker;

DatePicker::builder().action_id("foo")
                     .initial_date((01, 05, 2021))
                     .build();

Set confirm (Optional)

A confirm object 🔗 that defines an optional confirmation dialog that appears after a date is selected.

All done building, now give me a darn date picker!

no method name 'build' found for struct 'DatePickerBuilder<...>'? Make sure all required setter methods have been called. See docs for DatePickerBuilder.

use slack_blocks::elems::DatePicker;

let foo = DatePicker::builder().build(); // Won't compile!
use slack_blocks::{compose::Opt, elems::DatePicker};

let foo = DatePicker::builder().action_id("foo").build();

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

This is supported on crate feature blox only.

Identity function

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.