pub struct TimePicker { /* private fields */ }Expand description
Time 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_time | String | No | Must match the format “HH:mm” (24-hour format) |
| confirm | ConfirmationDialog | No | N/A |
| focus_on_load | bool | No | N/A |
| placeholder | Text<Plain> | No | Max length 150 characters |
| timezone | String | No | N/A |
§Example
use slack_messaging::plain_text;
use slack_messaging::blocks::elements::TimePicker;
let timepicker = TimePicker::builder()
.action_id("timepicker123")
.initial_time("11:30")
.timezone("Asia/Tokyo")
.placeholder(plain_text!("Select a time")?)
.build()?;
let expected = serde_json::json!({
"type": "timepicker",
"action_id": "timepicker123",
"initial_time": "11:30",
"timezone": "Asia/Tokyo",
"placeholder": {
"type": "plain_text",
"text": "Select a time"
}
});
let json = serde_json::to_value(timepicker).unwrap();
assert_eq!(json, expected);
// If your object has any validation errors, the build method returns Result::Err
let timepicker = TimePicker::builder()
.action_id("timepicker123")
.initial_time("25:30")
.build();
assert!(timepicker.is_err());Implementations§
Source§impl TimePicker
impl TimePicker
Sourcepub fn builder() -> TimePickerBuilder
pub fn builder() -> TimePickerBuilder
constract TimePickerBuilder object.
Trait Implementations§
Source§impl Clone for TimePicker
impl Clone for TimePicker
Source§fn clone(&self) -> TimePicker
fn clone(&self) -> TimePicker
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 TimePicker
impl Debug for TimePicker
Source§impl From<TimePicker> for Accessory
impl From<TimePicker> for Accessory
Source§fn from(value: TimePicker) -> Self
fn from(value: TimePicker) -> Self
Converts to this type from the input type.
Source§impl From<TimePicker> for ActionsElement
impl From<TimePicker> for ActionsElement
Source§fn from(value: TimePicker) -> Self
fn from(value: TimePicker) -> Self
Converts to this type from the input type.
Source§impl From<TimePicker> for InputElement
impl From<TimePicker> for InputElement
Source§fn from(value: TimePicker) -> Self
fn from(value: TimePicker) -> Self
Converts to this type from the input type.
Source§impl PartialEq for TimePicker
impl PartialEq for TimePicker
Source§impl Serialize for TimePicker
impl Serialize for TimePicker
impl StructuralPartialEq for TimePicker
Auto Trait Implementations§
impl Freeze for TimePicker
impl RefUnwindSafe for TimePicker
impl Send for TimePicker
impl Sync for TimePicker
impl Unpin for TimePicker
impl UnwindSafe for TimePicker
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)