radn-rs/src/rcore/origin.rs

19 lines
711 B
Rust

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