[−][src]Struct twilight_embed_builder::field::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]
name: impl Into<String>,
value: impl Into<String>
) -> Result<Self, EmbedFieldError>
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]
fn clone(&self) -> EmbedFieldBuilder
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[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]
fn eq(&self, other: &EmbedFieldBuilder) -> bool
[src]
fn ne(&self, other: &EmbedFieldBuilder) -> bool
[src]
impl StructuralEq for EmbedFieldBuilder
[src]
impl StructuralPartialEq for EmbedFieldBuilder
[src]
Auto Trait Implementations
impl RefUnwindSafe for EmbedFieldBuilder
impl Send for EmbedFieldBuilder
impl Sync for EmbedFieldBuilder
impl Unpin for EmbedFieldBuilder
impl UnwindSafe for EmbedFieldBuilder
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,