noosphere_into/resolver/
link.rs

1use std::fmt::Display;
2
3use subtext::Slashlink;
4
5#[cfg(doc)]
6use crate::Resolver;
7#[cfg(doc)]
8use crate::Transcluder;
9
10/// This enum represents the resolved value that may be returned by a [Resolver]
11/// and is provided to a [Transcluder]
12pub enum ResolvedLink {
13    Hyperlink { href: String },
14    Slashlink { link: Slashlink, href: String },
15}
16
17impl Display for ResolvedLink {
18    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19        let href = match self {
20            ResolvedLink::Hyperlink { href } => href,
21            ResolvedLink::Slashlink { href, .. } => href,
22        };
23        write!(f, "{href}")
24    }
25}