Skip to content

Commit

Permalink
Add and use AttachmentId (#559)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lakelezz authored and arqunis committed May 16, 2019
1 parent 0e3fe5f commit c8a5f69
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/model/channel/attachment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ use reqwest::Client as ReqwestClient;
use crate::internal::prelude::*;
#[cfg(feature = "model")]
use std::io::Read;
#[cfg(feature = "model")]
use super::id::AttachmentId;

/// A file uploaded with a message. Not to be confused with [`Embed`]s.
///
/// [`Embed`]: struct.Embed.html
#[cfg(feature = "model")]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Attachment {
/// The unique ID given to this attachment.
pub id: String,
pub id: AttachmentId,
/// The filename of the file that was uploaded. This is equivalent to what
/// the uploader had their file named.
pub filename: String,
Expand Down
5 changes: 5 additions & 0 deletions src/model/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,12 @@ pub struct WebhookId(pub u64);
#[derive(Copy, Clone, Default, Debug, Eq, Hash, PartialEq, PartialOrd, Ord, Serialize)]
pub struct AuditLogEntryId(pub u64);

/// An identifier for an attachment.
#[derive(Copy, Clone, Default, Debug, Eq, Hash, PartialEq, PartialOrd, Ord, Serialize)]
pub struct AttachmentId(u64);

id_u64! {
AttachmentId;
ApplicationId;
ChannelId;
EmojiId;
Expand Down

0 comments on commit c8a5f69

Please sign in to comment.