From d733b16533821b0bbb94b2fc51683109fd710d92 Mon Sep 17 00:00:00 2001 From: ymgyt Date: Mon, 6 May 2024 23:35:08 +0900 Subject: [PATCH] feat(feed): impl Borrow for FeedUrl --- crates/synd_feed/src/lib.rs | 1 + crates/synd_feed/src/types/mod.rs | 1 - crates/synd_feed/src/types/url.rs | 7 +++++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/synd_feed/src/lib.rs b/crates/synd_feed/src/lib.rs index d95fdb44..45fd5b54 100644 --- a/crates/synd_feed/src/lib.rs +++ b/crates/synd_feed/src/lib.rs @@ -1,4 +1,5 @@ #![allow(clippy::new_without_default)] +#![warn(rustdoc::broken_intra_doc_links)] pub mod feed; pub mod types; diff --git a/crates/synd_feed/src/types/mod.rs b/crates/synd_feed/src/types/mod.rs index 44b6711b..2ac30703 100644 --- a/crates/synd_feed/src/types/mod.rs +++ b/crates/synd_feed/src/types/mod.rs @@ -6,7 +6,6 @@ use feed_rs::model::{self as feedrs, Generator, Link, Person, Text}; pub use feedrs::FeedType; pub type Time = DateTime; -// pub type FeedUrl = String; mod requirement; pub use requirement::Requirement; diff --git a/crates/synd_feed/src/types/url.rs b/crates/synd_feed/src/types/url.rs index 29f4aea0..4c8a67dd 100644 --- a/crates/synd_feed/src/types/url.rs +++ b/crates/synd_feed/src/types/url.rs @@ -1,4 +1,5 @@ use core::fmt; +use std::borrow::Borrow; use serde::{Deserialize, Serialize}; use thiserror::Error; @@ -14,6 +15,12 @@ pub enum FeedUrlError { #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] pub struct FeedUrl(Url); +impl Borrow for FeedUrl { + fn borrow(&self) -> &Url { + &self.0 + } +} + impl TryFrom<&str> for FeedUrl { type Error = FeedUrlError;