#[non_exhaustive]pub struct Annotation {
pub type: AnnotationType,
pub start_index: Option<i32>,
pub length: i32,
pub metadata: Option<Metadata>,
/* private fields */
}Expand description
Output only. Annotations can be associated with the plain-text body of the
message or with chips that link to Google Workspace resources like Google
Docs or Sheets with start_index and length of 0. To add basic formatting
to a text message, see Format text
messages.
Example plain-text message body:
Hello @FooBot how are you!"The corresponding annotations metadata:
"annotations":[{
"type":"USER_MENTION",
"startIndex":6,
"length":7,
"userMention": {
"user": {
"name":"users/{user}",
"displayName":"FooBot",
"avatarUrl":"https://goo.gl/aeDtrS",
"type":"BOT"
},
"type":"MENTION"
}
}]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.type: AnnotationTypeThe type of this annotation.
start_index: Option<i32>Start index (0-based, inclusive) in the plain-text message body this annotation corresponds to.
length: i32Length of the substring in the plain-text message body this annotation corresponds to. If not present, indicates a length of 0.
metadata: Option<Metadata>Additional metadata about the annotation.
Implementations§
Source§impl Annotation
impl Annotation
Sourcepub fn set_type<T: Into<AnnotationType>>(self, v: T) -> Self
pub fn set_type<T: Into<AnnotationType>>(self, v: T) -> Self
Sourcepub fn set_start_index<T>(self, v: T) -> Self
pub fn set_start_index<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_start_index<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_start_index<T>(self, v: Option<T>) -> Self
Sets or clears the value of start_index.
§Example
let x = Annotation::new().set_or_clear_start_index(Some(42));
let x = Annotation::new().set_or_clear_start_index(None::<i32>);Sourcepub fn set_length<T: Into<i32>>(self, v: T) -> Self
pub fn set_length<T: Into<i32>>(self, v: T) -> Self
Sourcepub fn set_metadata<T: Into<Option<Metadata>>>(self, v: T) -> Self
pub fn set_metadata<T: Into<Option<Metadata>>>(self, v: T) -> Self
Sourcepub fn user_mention(&self) -> Option<&Box<UserMentionMetadata>>
pub fn user_mention(&self) -> Option<&Box<UserMentionMetadata>>
The value of metadata
if it holds a UserMention, None if the field is not set or
holds a different branch.
Sourcepub fn set_user_mention<T: Into<Box<UserMentionMetadata>>>(self, v: T) -> Self
pub fn set_user_mention<T: Into<Box<UserMentionMetadata>>>(self, v: T) -> Self
Sets the value of metadata
to hold a UserMention.
Note that all the setters affecting metadata are
mutually exclusive.
§Example
use google_chat_v1::model::UserMentionMetadata;
let x = Annotation::new().set_user_mention(UserMentionMetadata::default()/* use setters */);
assert!(x.user_mention().is_some());
assert!(x.slash_command().is_none());
assert!(x.rich_link_metadata().is_none());
assert!(x.custom_emoji_metadata().is_none());Sourcepub fn slash_command(&self) -> Option<&Box<SlashCommandMetadata>>
pub fn slash_command(&self) -> Option<&Box<SlashCommandMetadata>>
The value of metadata
if it holds a SlashCommand, None if the field is not set or
holds a different branch.
Sourcepub fn set_slash_command<T: Into<Box<SlashCommandMetadata>>>(self, v: T) -> Self
pub fn set_slash_command<T: Into<Box<SlashCommandMetadata>>>(self, v: T) -> Self
Sets the value of metadata
to hold a SlashCommand.
Note that all the setters affecting metadata are
mutually exclusive.
§Example
use google_chat_v1::model::SlashCommandMetadata;
let x = Annotation::new().set_slash_command(SlashCommandMetadata::default()/* use setters */);
assert!(x.slash_command().is_some());
assert!(x.user_mention().is_none());
assert!(x.rich_link_metadata().is_none());
assert!(x.custom_emoji_metadata().is_none());Sourcepub fn rich_link_metadata(&self) -> Option<&Box<RichLinkMetadata>>
pub fn rich_link_metadata(&self) -> Option<&Box<RichLinkMetadata>>
The value of metadata
if it holds a RichLinkMetadata, None if the field is not set or
holds a different branch.
Sourcepub fn set_rich_link_metadata<T: Into<Box<RichLinkMetadata>>>(
self,
v: T,
) -> Self
pub fn set_rich_link_metadata<T: Into<Box<RichLinkMetadata>>>( self, v: T, ) -> Self
Sets the value of metadata
to hold a RichLinkMetadata.
Note that all the setters affecting metadata are
mutually exclusive.
§Example
use google_chat_v1::model::RichLinkMetadata;
let x = Annotation::new().set_rich_link_metadata(RichLinkMetadata::default()/* use setters */);
assert!(x.rich_link_metadata().is_some());
assert!(x.user_mention().is_none());
assert!(x.slash_command().is_none());
assert!(x.custom_emoji_metadata().is_none());Sourcepub fn custom_emoji_metadata(&self) -> Option<&Box<CustomEmojiMetadata>>
pub fn custom_emoji_metadata(&self) -> Option<&Box<CustomEmojiMetadata>>
The value of metadata
if it holds a CustomEmojiMetadata, None if the field is not set or
holds a different branch.
Sourcepub fn set_custom_emoji_metadata<T: Into<Box<CustomEmojiMetadata>>>(
self,
v: T,
) -> Self
pub fn set_custom_emoji_metadata<T: Into<Box<CustomEmojiMetadata>>>( self, v: T, ) -> Self
Sets the value of metadata
to hold a CustomEmojiMetadata.
Note that all the setters affecting metadata are
mutually exclusive.
§Example
use google_chat_v1::model::CustomEmojiMetadata;
let x = Annotation::new().set_custom_emoji_metadata(CustomEmojiMetadata::default()/* use setters */);
assert!(x.custom_emoji_metadata().is_some());
assert!(x.user_mention().is_none());
assert!(x.slash_command().is_none());
assert!(x.rich_link_metadata().is_none());Trait Implementations§
Source§impl Clone for Annotation
impl Clone for Annotation
Source§fn clone(&self) -> Annotation
fn clone(&self) -> Annotation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more