Skip to content

Commit

Permalink
fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
itohatweb committed Sep 17, 2022
1 parent 2560700 commit a93eda3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions twilight-model/src/http/attachment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use serde::{Deserialize, Serialize};
/// description for screen readers:
///
/// ```
/// use std::borrow::Cow;
/// use twilight_model::http::attachment::Attachment;
///
/// let filename = "twilight_sparkle.json".to_owned();
Expand All @@ -23,7 +24,7 @@ use serde::{Deserialize, Serialize};
/// .to_vec();
/// let id = 1;
///
/// let mut attachment = Attachment::from_bytes(filename, file_content, id);
/// let mut attachment = Attachment::from_bytes(filename, Cow::from(file_content), id);
/// attachment.description("Raw data about Twilight Sparkle".to_owned());
/// ```
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
Expand Down Expand Up @@ -56,13 +57,14 @@ impl<'a> Attachment<'a> {
/// Create an attachment with a grocery list named "grocerylist.txt":
///
/// ```
/// use std::borrowed::Cow;
/// use twilight_model::http::attachment::Attachment;
///
/// let filename = "grocerylist.txt".to_owned();
/// let file_content = b"Apples\nGrapes\nLemonade".to_vec();
/// let id = 1;
///
/// let attachment = Attachment::from_bytes(filename, file_content, id);
/// let attachment = Attachment::from_bytes(filename, Cow::from(file_content), id);
/// ```
pub const fn from_bytes(filename: String, file: Cow<'a, [u8]>, id: u64) -> Self {
Self {
Expand Down

0 comments on commit a93eda3

Please sign in to comment.