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: BlockElement =
  DatePicker::builder().action_id("foo").build().into();

let block: Block = Actions::try_from(picker).unwrap().into();

// <send block to slack API>

Implementations

impl<'a, A> DatePickerBuilder<'a, A>[src]

pub fn new() -> Self[src]

Create a new builder

pub fn action_id<S>(self, action_id: S) -> DatePickerBuilder<'a, Set<action_id>> where
    S: Into<Cow<'a, str>>, 
[src]

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.

pub fn placeholder<S>(self, placeholder: S) -> Self where
    S: Into<Plain>, 
[src]

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.

pub fn initial_date(self, day: u8, month: u8, year: u16) -> Self[src]

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();

pub fn confirm(self, confirm: Confirm) -> Self[src]

Set confirm (Optional)

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

impl<'a> DatePickerBuilder<'a, Set<action_id>>[src]

pub fn build(self) -> DatePicker<'a>[src]

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

impl<'a, A: Debug> Debug for DatePickerBuilder<'a, A>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<'a, A> RefUnwindSafe for DatePickerBuilder<'a, A> where
    A: RefUnwindSafe

impl<'a, A> Send for DatePickerBuilder<'a, A> where
    A: Send

impl<'a, A> Sync for DatePickerBuilder<'a, A> where
    A: Sync

impl<'a, A> Unpin for DatePickerBuilder<'a, A> where
    A: Unpin

impl<'a, A> UnwindSafe for DatePickerBuilder<'a, A> where
    A: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.