lemmy/crates/apub/src/protocol/objects/tombstone.rs

30 lines
590 B
Rust
Raw Normal View History

2022-05-06 23:53:33 +00:00
use crate::protocol::Id;
use activitystreams_kinds::object::TombstoneType;
use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;
2021-11-16 00:58:15 +00:00
use url::Url;
#[skip_serializing_none]
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Tombstone {
2021-11-16 00:58:15 +00:00
pub(crate) id: Url,
#[serde(rename = "type")]
2022-05-06 23:53:33 +00:00
pub(crate) kind: TombstoneType,
}
impl Tombstone {
2021-11-16 00:58:15 +00:00
pub fn new(id: Url) -> Tombstone {
Tombstone {
2021-11-16 00:58:15 +00:00
id,
kind: TombstoneType::Tombstone,
}
}
}
2022-05-06 23:53:33 +00:00
impl Id for Tombstone {
fn object_id(&self) -> &Url {
2022-05-06 23:53:33 +00:00
&self.id
}
}