pub struct FileBuilder { /* private fields */ }Expand description
Builds a file component: a file uploaded with the message, shown as a downloadable box.
The URL must be attachment://name naming one of the message’s files — Discord refuses
links here (D-205).
discord.js counterpart: FileBuilder.
§Examples
use djs_builders::FileBuilder;
assert!(FileBuilder::new("attachment://report.pdf").build().is_ok());
assert!(FileBuilder::new("https://example.com/report.pdf").build().is_err());Implementations§
Source§impl FileBuilder
impl FileBuilder
Source§impl FileBuilder
impl FileBuilder
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 FileBuilder
impl Clone for FileBuilder
Source§impl Debug for FileBuilder
impl Debug for FileBuilder
impl Eq for FileBuilder
Source§impl From<FileBuilder> for Component
impl From<FileBuilder> for Component
Source§fn from(builder: FileBuilder) -> Self
fn from(builder: FileBuilder) -> Self
Converts to this type from the input type.
Source§impl PartialEq for FileBuilder
impl PartialEq for FileBuilder
impl StructuralPartialEq for FileBuilder
Auto Trait Implementations§
impl Freeze for FileBuilder
impl RefUnwindSafe for FileBuilder
impl Send for FileBuilder
impl Sync for FileBuilder
impl Unpin for FileBuilder
impl UnsafeUnpin for FileBuilder
impl UnwindSafe for FileBuilder
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