Skip to content

Commit

Permalink
feat(feed): impl Borrow<Url> for FeedUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
ymgyt committed May 6, 2024
1 parent b0514e8 commit d733b16
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions crates/synd_feed/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![allow(clippy::new_without_default)]
#![warn(rustdoc::broken_intra_doc_links)]

pub mod feed;
pub mod types;
1 change: 0 additions & 1 deletion crates/synd_feed/src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use feed_rs::model::{self as feedrs, Generator, Link, Person, Text};
pub use feedrs::FeedType;

pub type Time = DateTime<Utc>;
// pub type FeedUrl = String;

mod requirement;
pub use requirement::Requirement;
Expand Down
7 changes: 7 additions & 0 deletions crates/synd_feed/src/types/url.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use core::fmt;
use std::borrow::Borrow;

use serde::{Deserialize, Serialize};
use thiserror::Error;
Expand All @@ -14,6 +15,12 @@ pub enum FeedUrlError {
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct FeedUrl(Url);

impl Borrow<Url> for FeedUrl {
fn borrow(&self) -> &Url {
&self.0
}
}

impl TryFrom<&str> for FeedUrl {
type Error = FeedUrlError;

Expand Down

0 comments on commit d733b16

Please sign in to comment.