radn-rs/src/rcore/origin.rs
2023-06-30 20:19:16 +00:00

15 lines
523 B
Rust

use super::*;
/// Represents a potentially resolvable [`Mentionable`].
pub trait Origin<'a, Ctx: Context<'a>>: 'a {
/// Type of the associated object.
type Mtbl: Mentionable<'a, Ctx>;
/// Value of the associated factory.
fn factory(&self) -> OFctr<'a, Ctx, Self>;
/// Try resolving the value.
fn resolve(self: Rc<Self>) -> Resolution<'a, Ctx, Self::Mtbl>;
fn resolve_bytes(self: Rc<Self>) -> HashResolution<'a, Ctx>;
}
pub type OFctr<'a, Ctx, O> = Fctr<'a, Ctx, <O as Origin<'a, Ctx>>::Mtbl>;