#[non_exhaustive]pub struct KeyValue {
pub top_label: String,
pub content: String,
pub content_multiline: bool,
pub bottom_label: String,
pub on_click: Option<OnClick>,
pub icons: Option<Icons>,
pub control: Option<Control>,
/* private fields */
}Expand description
A UI element contains a key (label) and a value (content). This
element can also contain some actions such as onclick button.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.top_label: StringThe text of the top label. Formatted text supported. For more information about formatting text, see Formatting text in Google Chat apps and Formatting text in Google Workspace Add-ons.
content: StringThe text of the content. Formatted text supported and always required. For more information about formatting text, see Formatting text in Google Chat apps and Formatting text in Google Workspace Add-ons.
content_multiline: boolIf the content should be multiline.
bottom_label: StringThe text of the bottom label. Formatted text supported. For more information about formatting text, see Formatting text in Google Chat apps and Formatting text in Google Workspace Add-ons.
on_click: Option<OnClick>The onclick action. Only the top label, bottom label, and content
region are clickable.
icons: Option<Icons>At least one of icons, top_label and bottom_label must be defined.
control: Option<Control>A control widget. You can set either button or switch_widget,
but not both.
Implementations§
Source§impl KeyValue
impl KeyValue
Sourcepub fn set_top_label<T: Into<String>>(self, v: T) -> Self
pub fn set_top_label<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_content<T: Into<String>>(self, v: T) -> Self
pub fn set_content<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_content_multiline<T: Into<bool>>(self, v: T) -> Self
pub fn set_content_multiline<T: Into<bool>>(self, v: T) -> Self
Sourcepub fn set_bottom_label<T: Into<String>>(self, v: T) -> Self
pub fn set_bottom_label<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_on_click<T>(self, v: T) -> Self
pub fn set_on_click<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_on_click<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_on_click<T>(self, v: Option<T>) -> Self
Sourcepub fn set_icons<T: Into<Option<Icons>>>(self, v: T) -> Self
pub fn set_icons<T: Into<Option<Icons>>>(self, v: T) -> Self
Sets the value of icons.
Note that all the setters affecting icons are mutually
exclusive.
§Example
use google_chat_v1::model::widget_markup::Icon;
let x0 = KeyValue::new().set_icons(Some(
google_chat_v1::model::widget_markup::key_value::Icons::Icon(Icon::Airplane)));
let x1 = KeyValue::new().set_icons(Some(
google_chat_v1::model::widget_markup::key_value::Icons::Icon(Icon::Bookmark)));
let x2 = KeyValue::new().set_icons(Some(
google_chat_v1::model::widget_markup::key_value::Icons::Icon(Icon::Bus)));Sourcepub fn icon(&self) -> Option<&Icon>
pub fn icon(&self) -> Option<&Icon>
The value of icons
if it holds a Icon, None if the field is not set or
holds a different branch.
Sourcepub fn set_icon<T: Into<Icon>>(self, v: T) -> Self
pub fn set_icon<T: Into<Icon>>(self, v: T) -> Self
Sets the value of icons
to hold a Icon.
Note that all the setters affecting icons are
mutually exclusive.
§Example
use google_chat_v1::model::widget_markup::Icon;
let x0 = KeyValue::new().set_icon(Icon::Airplane);
let x1 = KeyValue::new().set_icon(Icon::Bookmark);
let x2 = KeyValue::new().set_icon(Icon::Bus);
assert!(x0.icon().is_some());
assert!(x0.icon_url().is_none());
assert!(x1.icon().is_some());
assert!(x1.icon_url().is_none());
assert!(x2.icon().is_some());
assert!(x2.icon_url().is_none());Sourcepub fn icon_url(&self) -> Option<&String>
pub fn icon_url(&self) -> Option<&String>
The value of icons
if it holds a IconUrl, None if the field is not set or
holds a different branch.
Sourcepub fn set_icon_url<T: Into<String>>(self, v: T) -> Self
pub fn set_icon_url<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_control<T: Into<Option<Control>>>(self, v: T) -> Self
pub fn set_control<T: Into<Option<Control>>>(self, v: T) -> Self
The value of control
if it holds a Button, None if the field is not set or
holds a different branch.