1
0
Fork 0
forked from alemi/upub

feat(apb): Addressed auto impl for any Object

This commit is contained in:
əlemi 2024-05-19 21:19:22 +02:00
parent eddde7c8b9
commit 8b15ae9f4f
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -6,8 +6,7 @@ pub trait Addressed {
fn addressed(&self) -> Vec<String>;
}
#[cfg(feature = "unstructured")]
impl Addressed for serde_json::Value {
impl<T: Object> Addressed for T {
fn addressed(&self) -> Vec<String> {
let mut to : Vec<String> = self.to().map(|x| x.href().to_string()).collect();
to.append(&mut self.bto().map(|x| x.href().to_string()).collect());