Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions twilight-model/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ serde-value = { default-features = false, version = "0.7" }
serde_repr = { default-features = false, version = "0.1.5" }
time = { default-features = false, features = ["parsing", "std"], version = "0.3" }
tracing = { default-features = false, version = "0.1.16" }
bytes = { default-features = false, version = "1" }

[dev-dependencies]
criterion = { default-features = false, version = "0.3" }
Expand Down
5 changes: 3 additions & 2 deletions twilight-model/src/http/attachment.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! Models used when sending attachments to Discord.

use bytes::Bytes;
use serde::{Deserialize, Serialize};

/// Attachments used in messages.
Expand Down Expand Up @@ -32,7 +33,7 @@ pub struct Attachment {
pub description: Option<String>,
/// Content of the file.
#[serde(skip)]
pub file: Vec<u8>,
pub file: Bytes,
/// Name of the file.
///
/// Examples may be "twilight_sparkle.png", "cat.jpg", or "logs.txt".
Expand Down Expand Up @@ -62,7 +63,7 @@ impl Attachment {
///
/// let attachment = Attachment::from_bytes(filename, file_content, id);
/// ```
pub const fn from_bytes(filename: String, file: Vec<u8>, id: u64) -> Self {
pub const fn from_bytes(filename: String, file: Bytes, id: u64) -> Self {
Self {
description: None,
file,
Expand Down