use crate::{CollectionId, Href};
#[derive(Debug, PartialEq)]
pub struct ResolvedMapping {
pub(crate) alias: String,
pub(crate) a: ResolvedCollection,
pub(crate) b: ResolvedCollection,
}
impl ResolvedMapping {
#[must_use]
pub fn alias(&self) -> &str {
&self.alias
}
#[must_use]
pub fn a(&self) -> &ResolvedCollection {
&self.a
}
#[must_use]
pub fn b(&self) -> &ResolvedCollection {
&self.b
}
}
impl std::fmt::Display for ResolvedMapping {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
String::fmt(&self.alias, f)
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ResolvedCollection {
pub(crate) id: Option<CollectionId>,
pub(crate) href: Href,
pub(crate) exists: bool,
}
impl ResolvedCollection {
#[must_use]
pub fn id(&self) -> Option<&CollectionId> {
self.id.as_ref()
}
#[must_use]
pub fn href(&self) -> &Href {
&self.href
}
}