Origin docs

This commit is contained in:
AF 2023-07-01 00:15:49 +00:00
parent f326b8385d
commit 32f4b46a44

View File

@ -4,11 +4,13 @@ use super::*;
pub trait Origin<'a, Ctx: Context<'a>>: 'a { pub trait Origin<'a, Ctx: Context<'a>>: 'a {
/// Type of the associated object. /// Type of the associated object.
type Mtbl: Mentionable<'a, Ctx>; type Mtbl: Mentionable<'a, Ctx>;
/// Value of the associated factory. /// Clone the associated factory.
fn factory(&self) -> OFctr<'a, Ctx, Self>; fn factory(&self) -> OFctr<'a, Ctx, Self>;
/// Try resolving the value. /// Try resolving the value.
fn resolve(self: Rc<Self>) -> Resolution<'a, Ctx, Self::Mtbl>; fn resolve(self: Rc<Self>) -> Resolution<'a, Ctx, Self::Mtbl>;
/// Try resolving the bytes. Should avoid parsing the value.
fn resolve_bytes(self: Rc<Self>) -> HashResolution<'a, Ctx>; 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>; pub type OFctr<'a, Ctx, O> = Fctr<'a, Ctx, <O as Origin<'a, Ctx>>::Mtbl>;