From 4e344468946ea6dae742b9daf7652241214612be Mon Sep 17 00:00:00 2001 From: alemi Date: Fri, 12 Apr 2024 21:55:19 +0200 Subject: [PATCH] fix: oops must be generic impl --- src/model/mod.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/model/mod.rs b/src/model/mod.rs index 279b16d8..cfac749a 100644 --- a/src/model/mod.rs +++ b/src/model/mod.rs @@ -29,15 +29,14 @@ impl From for axum::http::StatusCode { #[derive(Clone, Debug, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize, sea_orm::FromJsonQueryResult)] pub struct Audience(pub Vec); -impl From> for Audience { - fn from(value: apb::Node) -> Self { - use apb::{Base, Link}; +impl From> for Audience { + fn from(value: apb::Node) -> Self { Audience( match value { apb::Node::Empty => vec![], apb::Node::Link(l) => vec![l.href().to_string()], apb::Node::Object(o) => if let Some(id) = o.id() { vec![id.to_string()] } else { vec![] }, - apb::Node::Array(arr) => arr.into_iter().map(|l| l.href().to_string()).collect(), + apb::Node::Array(arr) => arr.into_iter().filter_map(|l| Some(l.id()?.to_string())).collect(), } ) }