Clean up debug impls

This commit is contained in:
Aode (Lion)
2021-09-21 14:32:25 -05:00
parent 4b4aaaa0b4
commit 3384ca9064
17 changed files with 182 additions and 31 deletions
+10 -1
View File
@@ -11,12 +11,21 @@ use activitystreams::{activity::Announce as AsAnnounce, url::Url};
use background_jobs::ActixJob;
use std::{future::Future, pin::Pin};
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
#[derive(Clone, serde::Deserialize, serde::Serialize)]
pub(crate) struct Announce {
object_id: Url,
actor: Actor,
}
impl std::fmt::Debug for Announce {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("Announce")
.field("object_id", &self.object_id.to_string())
.field("actor", &self.actor)
.finish()
}
}
impl Announce {
pub fn new(object_id: Url, actor: Actor) -> Self {
Announce { object_id, actor }
+10 -1
View File
@@ -7,12 +7,21 @@ use activitystreams::{object::Image, prelude::*, url::Url};
use background_jobs::ActixJob;
use std::{future::Future, pin::Pin};
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
#[derive(Clone, serde::Deserialize, serde::Serialize)]
pub(crate) struct QueryContact {
actor_id: Url,
contact_id: Url,
}
impl std::fmt::Debug for QueryContact {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("QueryContact")
.field("actor_id", &self.actor_id.to_string())
.field("contact_id", &self.contact_id.to_string())
.finish()
}
}
impl QueryContact {
pub(crate) fn new(actor_id: Url, contact_id: Url) -> Self {
QueryContact {
+10 -1
View File
@@ -3,12 +3,21 @@ use activitystreams::url::Url;
use background_jobs::{ActixJob, Backoff};
use std::{future::Future, pin::Pin};
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
#[derive(Clone, serde::Deserialize, serde::Serialize)]
pub(crate) struct Deliver {
to: Url,
data: serde_json::Value,
}
impl std::fmt::Debug for Deliver {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("Deliver")
.field("to", &self.to.to_string())
.field("data", &self.data)
.finish()
}
}
impl Deliver {
pub(crate) fn new<T>(to: Url, data: T) -> Result<Self, Error>
where
+18 -1
View File
@@ -6,12 +6,29 @@ use activitystreams::url::Url;
use background_jobs::ActixJob;
use std::future::{ready, Ready};
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
#[derive(Clone, serde::Deserialize, serde::Serialize)]
pub(crate) struct DeliverMany {
to: Vec<Url>,
data: serde_json::Value,
}
impl std::fmt::Debug for DeliverMany {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let to = format!(
"[{}]",
self.to
.iter()
.map(|u| u.to_string())
.collect::<Vec<_>>()
.join(", ")
);
f.debug_struct("DeliverMany")
.field("to", &to)
.field("data", &self.data)
.finish()
}
}
impl DeliverMany {
pub(crate) fn new<T>(to: Vec<Url>, data: T) -> Result<Self, Error>
where
+9 -1
View File
@@ -7,11 +7,19 @@ use activitystreams::url::Url;
use background_jobs::ActixJob;
use std::{future::Future, pin::Pin};
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
#[derive(Clone, serde::Deserialize, serde::Serialize)]
pub(crate) struct QueryInstance {
actor_id: Url,
}
impl std::fmt::Debug for QueryInstance {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("QueryInstance")
.field("actor_id", &self.actor_id.to_string())
.finish()
}
}
impl QueryInstance {
pub(crate) fn new(actor_id: Url) -> Self {
QueryInstance { actor_id }
+10 -2
View File
@@ -4,13 +4,21 @@ use crate::{
};
use activitystreams::url::Url;
use background_jobs::ActixJob;
use std::{future::Future, pin::Pin};
use std::{fmt::Debug, future::Future, pin::Pin};
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
#[derive(Clone, serde::Deserialize, serde::Serialize)]
pub(crate) struct QueryNodeinfo {
actor_id: Url,
}
impl Debug for QueryNodeinfo {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("QueryNodeinfo")
.field("actor_id", &self.actor_id.to_string())
.finish()
}
}
impl QueryNodeinfo {
pub(crate) fn new(actor_id: Url) -> Self {
QueryNodeinfo { actor_id }