EmbedBuilder

Struct EmbedBuilder 

Source
pub struct EmbedBuilder<'a> { /* private fields */ }
Expand description

Builder for creating an Embed.

Implementations§

Source§

impl<'a> EmbedBuilder<'a>

Source

pub fn new() -> Self

Create a new EmbedBuilder.

Source

pub fn simple( title: impl Into<TitanString<'a>>, description: impl Into<TitanString<'a>>, ) -> Self

Create a simple embed with title and description.

Source

pub fn success( title: impl Into<TitanString<'a>>, description: impl Into<TitanString<'a>>, ) -> Self

Create a success embed (green color).

Source

pub fn error( title: impl Into<TitanString<'a>>, description: impl Into<TitanString<'a>>, ) -> Self

Create an error embed (red color).

Source

pub fn info( title: impl Into<TitanString<'a>>, description: impl Into<TitanString<'a>>, ) -> Self

Create an info embed (blurple color).

Source

pub fn warning( title: impl Into<TitanString<'a>>, description: impl Into<TitanString<'a>>, ) -> Self

Create a warning embed (yellow color).

Source

pub fn title(self, title: impl Into<TitanString<'a>>) -> Self

Set the title of the embed.

Source

pub fn description(self, description: impl Into<TitanString<'a>>) -> Self

Set the description of the embed.

Source

pub fn url(self, url: impl Into<TitanString<'a>>) -> Self

Set the URL of the embed.

Source

pub fn timestamp(self, timestamp: impl Into<TitanString<'a>>) -> Self

Set the timestamp of the embed.

Source

pub fn color(self, color: u32) -> Self

Set the color of the embed.

Source

pub fn color_rgb(self, r: u8, g: u8, b: u8) -> Self

Set the color of the embed from RGB values.

Source

pub fn footer( self, text: impl Into<TitanString<'a>>, icon_url: Option<impl Into<TitanString<'a>>>, ) -> Self

Set the footer of the embed.

Source

pub fn image(self, url: impl Into<TitanString<'a>>) -> Self

Set the image of the embed.

Source

pub fn thumbnail(self, url: impl Into<TitanString<'a>>) -> Self

Set the thumbnail of the embed.

Source

pub fn author( self, name: impl Into<TitanString<'a>>, url: Option<impl Into<TitanString<'a>>>, icon_url: Option<impl Into<TitanString<'a>>>, ) -> Self

Set the author of the embed.

Source

pub fn field( self, name: impl Into<TitanString<'a>>, value: impl Into<TitanString<'a>>, inline: bool, ) -> Self

Add a field to the embed.

Source

pub fn field_inline( self, name: impl Into<TitanString<'a>>, value: impl Into<TitanString<'a>>, ) -> Self

Add an inline field.

Source

pub fn field_block( self, name: impl Into<TitanString<'a>>, value: impl Into<TitanString<'a>>, ) -> Self

Add a block field (not inline).

Source

pub fn build(self) -> Embed<'a>

Build the Embed.

Trait Implementations§

Source§

impl<'a> Clone for EmbedBuilder<'a>

Source§

fn clone(&self) -> EmbedBuilder<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for EmbedBuilder<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Default for EmbedBuilder<'a>

Source§

fn default() -> EmbedBuilder<'a>

Returns the “default value” for a type. Read more
Source§

impl<'a> From<EmbedBuilder<'a>> for Embed<'a>

EmbedBuilder automatically converts to Embed

Source§

fn from(builder: EmbedBuilder<'a>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a> Freeze for EmbedBuilder<'a>

§

impl<'a> RefUnwindSafe for EmbedBuilder<'a>

§

impl<'a> Send for EmbedBuilder<'a>

§

impl<'a> Sync for EmbedBuilder<'a>

§

impl<'a> Unpin for EmbedBuilder<'a>

§

impl<'a> UnwindSafe for EmbedBuilder<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.