pub struct SeparatorBuilder { /* private fields */ }Expand description
Builds a separator: vertical space between components, with a line by default.
discord.js counterpart: SeparatorBuilder.
§Examples
use djs_builders::SeparatorBuilder;
use djs_model::component::SeparatorSpacing;
let gap = SeparatorBuilder::new().divider(false).spacing(SeparatorSpacing::Large).build().unwrap();
assert_eq!(
serde_json::to_string(&gap).unwrap(),
r#"{"type":14,"divider":false,"spacing":2}"#
);Implementations§
Source§impl SeparatorBuilder
impl SeparatorBuilder
Source§impl SeparatorBuilder
impl SeparatorBuilder
Sourcepub fn id(self, id: i32) -> Self
pub fn id(self, id: i32) -> Self
Sets the component’s numeric identifier (Discord generates one otherwise); it must be unique in the message or modal.
discord.js counterpart: setId.
Sourcepub fn build(self) -> Result<Component, ValidationError>
pub fn build(self) -> Result<Component, ValidationError>
Checks the component (and what it contains) and returns it.
discord.js counterpart: toJSON of the component builders.
§Errors
The first ValidationError found; see the type docs
for the rules.
Sourcepub fn build_unchecked(self) -> Component
pub fn build_unchecked(self) -> Component
Returns the component without any check (D-180).
discord.js counterpart: toJSON of the component builders with validation off (disableValidators).
Trait Implementations§
Source§impl Clone for SeparatorBuilder
impl Clone for SeparatorBuilder
Source§impl Debug for SeparatorBuilder
impl Debug for SeparatorBuilder
Source§impl Default for SeparatorBuilder
impl Default for SeparatorBuilder
impl Eq for SeparatorBuilder
Source§impl From<SeparatorBuilder> for Component
impl From<SeparatorBuilder> for Component
Source§fn from(builder: SeparatorBuilder) -> Self
fn from(builder: SeparatorBuilder) -> Self
Converts to this type from the input type.
Source§impl PartialEq for SeparatorBuilder
impl PartialEq for SeparatorBuilder
impl StructuralPartialEq for SeparatorBuilder
Auto Trait Implementations§
impl Freeze for SeparatorBuilder
impl RefUnwindSafe for SeparatorBuilder
impl Send for SeparatorBuilder
impl Sync for SeparatorBuilder
impl Unpin for SeparatorBuilder
impl UnsafeUnpin for SeparatorBuilder
impl UnwindSafe for SeparatorBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more