1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use crate::url::Url;

#[derive(Debug, Clone, Default, PartialEq, Eq)]
pub struct Links {
    pub homepage: Option<Url>,
    pub image: Option<Url>,
    pub image_href: Option<Url>,
    pub custom: Vec<CustomLink>,
}

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct CustomLink {
    pub url: Url,
    pub title: Option<String>,
    pub description: Option<String>,
}

impl CustomLink {
    pub const fn from_url(url: Url) -> Self {
        Self {
            url,
            title: None,
            description: None,
        }
    }
}

impl From<Url> for CustomLink {
    fn from(url: Url) -> Self {
        Self::from_url(url)
    }
}