Implement PartialEq for testing

This commit is contained in:
Felix Ableitner 2023-11-10 16:40:26 +01:00
parent 171d32720e
commit 99ea75b4be
3 changed files with 13 additions and 3 deletions

View file

@ -96,3 +96,13 @@ where
CollectionId(Box::new(url), PhantomData::<Kind>)
}
}
impl<Kind> PartialEq for CollectionId<Kind>
where
Kind: Collection,
for<'de2> <Kind as Collection>::Kind: serde::Deserialize<'de2>,
{
fn eq(&self, other: &Self) -> bool {
self.0.eq(&other.0) && self.1 == other.1
}
}

View file

@ -6,7 +6,7 @@ use url::Url;
/// Public key of actors which is used for HTTP signatures.
///
/// This needs to be federated in the `public_key` field of all actors.
#[derive(Clone, Debug, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct PublicKey {
/// Id of this private key.

View file

@ -35,7 +35,7 @@ use serde::{Deserialize, Serialize};
/// Media type for markdown text.
///
/// <https://www.iana.org/assignments/media-types/media-types.xhtml>
#[derive(Clone, Debug, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
pub enum MediaTypeMarkdown {
/// `text/markdown`
#[serde(rename = "text/markdown")]
@ -45,7 +45,7 @@ pub enum MediaTypeMarkdown {
/// Media type for HTML text.
///
/// <https://www.iana.org/assignments/media-types/media-types.xhtml>
#[derive(Clone, Debug, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
pub enum MediaTypeHtml {
/// `text/html`
#[serde(rename = "text/html")]