[][src]Struct twilight_embed_builder::field::EmbedFieldBuilder

#[must_use = "must be built into an embed field"]pub struct EmbedFieldBuilder(_);

Create an embed field with a builder.

This can be passed into EmbedBuilder::field.

Fields are not inlined by default. Use inline to inline a field.

Implementations

impl EmbedFieldBuilder[src]

pub const NAME_LENGTH_LIMIT: usize[src]

The maximum number of UTF-16 code points that can be in a field name.

This is used by new.

pub const VALUE_LENGTH_LIMIT: usize[src]

The maximum number of UTF-16 code points that can be in a field value.

This is used by new.

pub fn new(
    name: impl Into<String>,
    value: impl Into<String>
) -> Result<Self, EmbedFieldError>
[src]

Create a new default embed field builder.

The name is limited to 256 UTF-16 code points, and the value is limited to 1024.

Errors

Returns EmbedFieldError::NameEmpty if the provided name is empty.

Returns EmbedFieldError::NameTooLong if the provided name is longer than 256 UTF-16 code points.

Returns EmbedFieldError::ValueEmpty if the provided value is empty.

Returns EmbedFieldError::ValueTooLong if the provided value is longer than 1024 UTF-16 code points.

#[must_use = "should be used as part of an embed builder"]pub fn build(self) -> EmbedField[src]

Build into an embed field.

pub fn inline(self) -> Self[src]

Inline the field.

Examples

Create an inlined field:

use twilight_embed_builder::EmbedFieldBuilder;

let field = EmbedFieldBuilder::new("twilight", "is cool")?
    .inline()
    .build();

Trait Implementations

impl Clone for EmbedFieldBuilder[src]

impl Debug for EmbedFieldBuilder[src]

impl Eq for EmbedFieldBuilder[src]

impl From<EmbedFieldBuilder> for EmbedField[src]

fn from(builder: EmbedFieldBuilder) -> Self[src]

Convert an embed field builder into an embed field.

This is equivalent to calling EmbedFieldBuilder::build.

impl PartialEq<EmbedFieldBuilder> for EmbedFieldBuilder[src]

impl StructuralEq for EmbedFieldBuilder[src]

impl StructuralPartialEq for EmbedFieldBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.