28 lines
843 B
Rust
28 lines
843 B
Rust
use super::*;
|
|
|
|
/// The main way to represent a reference in ADN.
|
|
pub struct Point<'a, Ctx: Context<'a>, A: Mentionable<'a, Ctx>> {
|
|
/// Hash of the referred content.
|
|
/// Derived both from the serialised value ([`Serializable::serialize`])
|
|
/// and its topology ([`Mentionable::topology`]).
|
|
pub point: Hash,
|
|
/// [Origin] used in [`Point::resolve`].
|
|
pub origin: Rc<dyn Origin<'a, Ctx, Mtbl = A>>,
|
|
}
|
|
|
|
impl<'a, Ctx: Context<'a>, A: Mentionable<'a, Ctx>> Clone for Point<'a, Ctx, A> {
|
|
fn clone(&self) -> Self {
|
|
Self {
|
|
point: self.point,
|
|
origin: self.origin.clone(),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl<'a, Ctx: Context<'a>, A: Mentionable<'a, Ctx>> Point<'a, Ctx, A> {
|
|
/// See [`Origin::resolve`].
|
|
pub fn resolve(&self) -> Resolution<'a, Ctx, A> {
|
|
self.origin.clone().resolve()
|
|
}
|
|
}
|