From 813daf581088c585876d63cf03a351c8b3958dda Mon Sep 17 00:00:00 2001 From: Cappy Ishihara Date: Fri, 6 Dec 2024 23:31:24 +0700 Subject: [PATCH] cargo fmt --- skystreamer/src/stream.rs | 4 ++-- skystreamer/src/types/actor.rs | 1 - skystreamer/src/types/commit.rs | 11 +++-------- skystreamer/src/types/feed.rs | 6 +++--- skystreamer/src/types/graph.rs | 2 +- skystreamer/src/types/mod.rs | 8 +++----- 6 files changed, 12 insertions(+), 20 deletions(-) diff --git a/skystreamer/src/stream.rs b/skystreamer/src/stream.rs index b74d1a5..70c9518 100644 --- a/skystreamer/src/stream.rs +++ b/skystreamer/src/stream.rs @@ -86,9 +86,9 @@ impl EventStream { /// Start streaming events from the firehose, /// and flatten blocks of commits into individual records. - /// + /// /// This function returns a [`futures::Stream`] of [`commit::Record`]s. - /// + /// pub async fn stream(&mut self) -> Result + '_> { let block_stream = self.subscription.stream_commits(); diff --git a/skystreamer/src/types/actor.rs b/skystreamer/src/types/actor.rs index d69e1fb..1db1a92 100644 --- a/skystreamer/src/types/actor.rs +++ b/skystreamer/src/types/actor.rs @@ -37,7 +37,6 @@ pub struct Profile { } impl Profile { - /// Create a new profile from their record stream. /// Used in the [`crate::stream::EventStream`] to create a profile from a commit. pub fn new(did: Did, record: bsky::actor::profile::Record, cid: Option) -> Self { diff --git a/skystreamer/src/types/commit.rs b/skystreamer/src/types/commit.rs index 5980e1a..ef2a842 100644 --- a/skystreamer/src/types/commit.rs +++ b/skystreamer/src/types/commit.rs @@ -37,7 +37,7 @@ pub enum Record { impl Record { /// Deserialize an operation into the Record enum, given a commit. - /// + /// /// Returns all the records that can be extracted from the operation. pub async fn from_op(op: &Operation, commit: &ACommit) -> Result> { let mut blocks = commit.blocks.as_slice(); @@ -132,9 +132,8 @@ impl Record { } } - /// A singular commit, containing a list of operations. -/// +/// /// This is a wrapper around [`atrium_api::com::atproto::sync::subscribe_repos::Commit`]. #[derive(Debug, Clone, PartialEq, Eq)] pub struct Commit { @@ -161,10 +160,7 @@ impl From<&ACommit> for Commit { } /// Extract a post record from a commit. -#[deprecated( - note = "Please use [`Record::from_op`] instead.", - since = "0.2.0" -)] +#[deprecated(note = "Please use [`Record::from_op`] instead.", since = "0.2.0")] pub async fn extract_post_record( op: &atrium_api::com::atproto::sync::subscribe_repos::RepoOp, mut blocks: &[u8], @@ -187,7 +183,6 @@ pub async fn extract_post_record( } impl Commit { - /// Get the inner commit data, in case you need to access the raw commit. pub fn inner(&self) -> &ACommit { &self.inner_commit diff --git a/skystreamer/src/types/feed.rs b/skystreamer/src/types/feed.rs index e0d35a3..810de07 100644 --- a/skystreamer/src/types/feed.rs +++ b/skystreamer/src/types/feed.rs @@ -1,5 +1,5 @@ //! Helper types for bsky feed events, detailing user interactions with posts. -//! +//! //! These events are emitted when a user interacts with a post, adding data to the feed. use crate::util::{conv_atrium_cid, datetime_to_chrono}; @@ -12,7 +12,7 @@ use cid::Cid; use serde::{Deserialize, Serialize}; /// An event where someone likes a post -/// +/// /// This event is emitted when someone likes a post on the network. #[derive(Debug, Clone, Serialize, Deserialize)] pub struct LikeEvent { @@ -36,7 +36,7 @@ impl LikeEvent { } /// An event where someone reposts a post -/// +/// /// This event is emitted when someone reposts a post on the network. #[derive(Debug, Clone, Serialize, Deserialize)] pub struct RepostEvent { diff --git a/skystreamer/src/types/graph.rs b/skystreamer/src/types/graph.rs index 9331b74..d366a01 100644 --- a/skystreamer/src/types/graph.rs +++ b/skystreamer/src/types/graph.rs @@ -11,7 +11,7 @@ use chrono::{DateTime, FixedOffset}; use serde::{Deserialize, Serialize}; /// An event where someone blocks someone else :( -/// +/// /// This event is emitted when someone blocks another user on the network. #[derive(Debug, Clone, Serialize, Deserialize)] pub struct BlockEvent { diff --git a/skystreamer/src/types/mod.rs b/skystreamer/src/types/mod.rs index 6c27c6f..ec8e456 100644 --- a/skystreamer/src/types/mod.rs +++ b/skystreamer/src/types/mod.rs @@ -197,7 +197,7 @@ impl From for Embed { } /// A post on the network -/// +/// /// An idiomatic wrapper type around [`atrium_api::app::bsky::feed::post::Record`] #[derive(Debug, Serialize, Deserialize, Clone)] pub struct Post { @@ -219,13 +219,12 @@ impl Post { Self::from(PostData::new(author, cid, record)) } - /// Get media associated with the post, if any - /// + /// /// Before this was implemented as a method, /// you were required to match each variant of the Embed union type from /// ATrium to get the media associated with the post. - /// + /// /// This function abstracts that away and returns a vector of Media types pub fn get_post_media(&self) -> Vec { let mut media = vec![]; @@ -352,7 +351,6 @@ impl PostData { // pub fn } - /// Downloads media associated with a post, returning bytes of the media pub async fn download_media( client: &atrium_api::client::Service,