Struct twitch_api::helix::chat::SendChatAnnouncementBody
source · [−]#[non_exhaustive]pub struct SendChatAnnouncementBody<'a> {
pub message: Cow<'a, str>,
pub color: AnnouncementColor,
}
Available on crate feature
helix
only.Expand description
Body Parameters for Send Chat Announcement
Fields (Non-exhaustive)
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.message: Cow<'a, str>
The announcement to make in the broadcaster’s chat room. Announcements are limited to a maximum of 500 characters; announcements longer than 500 characters are truncated.
color: AnnouncementColor
The color used to highlight the announcement. Possible case-sensitive values are:
- blue
- green
- orange
- purple
- primary (default)
If color is set to primary or is not set, the channel’s accent color is used to highlight the announcement (see Profile Accent Color under profile settings, Channel and Videos, and Brand).
Implementations
sourceimpl<'a> SendChatAnnouncementBody<'a>
impl<'a> SendChatAnnouncementBody<'a>
sourceimpl<'a> SendChatAnnouncementBody<'a>
impl<'a> SendChatAnnouncementBody<'a>
sourcepub fn new<E>(
message: impl Into<Cow<'a, str>>,
color: impl TryInto<AnnouncementColor, Error = E>
) -> Result<Self, E>
pub fn new<E>(
message: impl Into<Cow<'a, str>>,
color: impl TryInto<AnnouncementColor, Error = E>
) -> Result<Self, E>
Create a new announcement with specified color
Examples found in repository?
src/helix/client/client_ext.rs (line 664)
652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670
pub async fn send_chat_announcement<'b, T, E>(
&'a self,
broadcaster_id: impl types::IntoCow<'b, types::UserIdRef> + 'b,
moderator_id: impl types::IntoCow<'b, types::UserIdRef> + 'b,
message: impl Into<&'b str>,
color: impl std::convert::TryInto<helix::chat::AnnouncementColor, Error = E>,
token: &T,
) -> Result<helix::chat::SendChatAnnouncementResponse, ClientExtError<'a, C, E>>
where
T: TwitchToken + ?Sized,
{
let req = helix::chat::SendChatAnnouncementRequest::new(broadcaster_id, moderator_id);
let body = helix::chat::SendChatAnnouncementBody::new(message.into(), color)?;
Ok(self
.req_post(req, body, token)
.await
.map_err(ClientExtError::ClientError)?
.data)
}
Trait Implementations
sourceimpl<'a> Clone for SendChatAnnouncementBody<'a>
impl<'a> Clone for SendChatAnnouncementBody<'a>
sourcefn clone(&self) -> SendChatAnnouncementBody<'a>
fn clone(&self) -> SendChatAnnouncementBody<'a>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl<'a> Debug for SendChatAnnouncementBody<'a>
impl<'a> Debug for SendChatAnnouncementBody<'a>
sourceimpl<'de: 'a, 'a> Deserialize<'de> for SendChatAnnouncementBody<'a>
impl<'de: 'a, 'a> Deserialize<'de> for SendChatAnnouncementBody<'a>
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<'a> PartialEq<SendChatAnnouncementBody<'a>> for SendChatAnnouncementBody<'a>
impl<'a> PartialEq<SendChatAnnouncementBody<'a>> for SendChatAnnouncementBody<'a>
sourcefn eq(&self, other: &SendChatAnnouncementBody<'a>) -> bool
fn eq(&self, other: &SendChatAnnouncementBody<'a>) -> bool
sourceimpl<'a> Serialize for SendChatAnnouncementBody<'a>
impl<'a> Serialize for SendChatAnnouncementBody<'a>
impl<'a> Eq for SendChatAnnouncementBody<'a>
impl<'a> StructuralEq for SendChatAnnouncementBody<'a>
impl<'a> StructuralPartialEq for SendChatAnnouncementBody<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for SendChatAnnouncementBody<'a>
impl<'a> Send for SendChatAnnouncementBody<'a>
impl<'a> Sync for SendChatAnnouncementBody<'a>
impl<'a> Unpin for SendChatAnnouncementBody<'a>
impl<'a> UnwindSafe for SendChatAnnouncementBody<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.sourceimpl<T> HelixRequestBody for Twhere
T: Serialize + SealedSerialize,
impl<T> HelixRequestBody for Twhere
T: Serialize + SealedSerialize,
sourcefn try_to_body(&self) -> Result<Bytes, BodyError>
fn try_to_body(&self) -> Result<Bytes, BodyError>
Available on crate feature
helix
only.Create the body