Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
korewaChino committed Dec 6, 2024
1 parent 7d70556 commit 813daf5
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 20 deletions.
4 changes: 2 additions & 2 deletions skystreamer/src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<impl futures::Stream<Item = commit::Record> + '_> {
let block_stream = self.subscription.stream_commits();

Expand Down
1 change: 0 additions & 1 deletion skystreamer/src/types/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<CidLink>) -> Self {
Expand Down
11 changes: 3 additions & 8 deletions skystreamer/src/types/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Vec<Self>> {
let mut blocks = commit.blocks.as_slice();
Expand Down Expand Up @@ -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 {
Expand All @@ -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],
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions skystreamer/src/types/feed.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand All @@ -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 {
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion skystreamer/src/types/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 3 additions & 5 deletions skystreamer/src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ impl From<RecordEmbedRefs> 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 {
Expand All @@ -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<Media> {
let mut media = vec![];
Expand Down Expand Up @@ -352,7 +351,6 @@ impl PostData {
// pub fn
}


/// Downloads media associated with a post, returning bytes of the media
pub async fn download_media<C>(
client: &atrium_api::client::Service<C>,
Expand Down

0 comments on commit 813daf5

Please sign in to comment.