pub struct DatePicker { /* private fields */ }Expand description
Date picker element representation.
§Fields and Validations
For more details, see the official documentation.
| Field | Type | Required | Validation |
|---|---|---|---|
| action_id | String | No | Max length 255 characters |
| initial_date | String | No | Must match date format “YYYY-MM-DD” |
| confirm | ConfirmationDialog | No | N/A |
| focus_on_load | bool | No | N/A |
| placeholder | Text<Plain> | No | Max length 150 characters |
§Example
use slack_messaging::plain_text;
use slack_messaging::blocks::elements::DatePicker;
let datepicker = DatePicker::builder()
.action_id("datepicker-123")
.initial_date("1990-04-28")
.placeholder(plain_text!("Select a date")?)
.build()?;
let expected = serde_json::json!({
"type": "datepicker",
"action_id": "datepicker-123",
"initial_date": "1990-04-28",
"placeholder": {
"type": "plain_text",
"text": "Select a date"
}
});
let json = serde_json::to_value(datepicker).unwrap();
assert_eq!(json, expected);
// If your object has any validation errors, the build method returns Result::Err
let datepicker = DatePicker::builder()
.action_id("datepicker-123")
.initial_date("1990-04-31")
.placeholder(plain_text!("Select a date")?)
.build();
assert!(datepicker.is_err());Implementations§
Source§impl DatePicker
impl DatePicker
Sourcepub fn builder() -> DatePickerBuilder
pub fn builder() -> DatePickerBuilder
constract DatePickerBuilder object.
Trait Implementations§
Source§impl Clone for DatePicker
impl Clone for DatePicker
Source§fn clone(&self) -> DatePicker
fn clone(&self) -> DatePicker
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DatePicker
impl Debug for DatePicker
Source§impl From<DatePicker> for Accessory
impl From<DatePicker> for Accessory
Source§fn from(value: DatePicker) -> Self
fn from(value: DatePicker) -> Self
Converts to this type from the input type.
Source§impl From<DatePicker> for ActionsElement
impl From<DatePicker> for ActionsElement
Source§fn from(value: DatePicker) -> Self
fn from(value: DatePicker) -> Self
Converts to this type from the input type.
Source§impl From<DatePicker> for InputElement
impl From<DatePicker> for InputElement
Source§fn from(value: DatePicker) -> Self
fn from(value: DatePicker) -> Self
Converts to this type from the input type.
Source§impl PartialEq for DatePicker
impl PartialEq for DatePicker
Source§impl Serialize for DatePicker
impl Serialize for DatePicker
impl StructuralPartialEq for DatePicker
Auto Trait Implementations§
impl Freeze for DatePicker
impl RefUnwindSafe for DatePicker
impl Send for DatePicker
impl Sync for DatePicker
impl Unpin for DatePicker
impl UnwindSafe for DatePicker
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)