loosen Origin bounds

This commit is contained in:
AF 2023-07-29 08:52:45 +00:00
parent c6b3029798
commit 8ab5d21089
2 changed files with 4 additions and 2 deletions

View File

@ -3,13 +3,14 @@ use super::*;
/// Represents a potentially resolvable [`Mentionable`]. /// Represents a potentially resolvable [`Mentionable`].
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: MentionableBase<'a, Ctx> + MentionableTop<'a, Ctx>; type Mtbl: MentionableBase<'a, Ctx>;
/// Clone 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>
where where
OFctr<'a, Ctx, Self>: Factory<'a, Ctx>; OFctr<'a, Ctx, Self>: Factory<'a, Ctx>,
Self::Mtbl: MentionableTop<'a, Ctx>;
/// Try resolving the bytes. Should avoid parsing the value. /// 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>;
} }

View File

@ -27,6 +27,7 @@ pub trait MappableOrigin<'a, Ctx: Context<'a>>: Origin<'a, Ctx> {
) -> Rc<dyn Origin<'a, Ctx, Mtbl = B>> ) -> Rc<dyn Origin<'a, Ctx, Mtbl = B>>
where where
OFctr<'a, Ctx, Self>: Factory<'a, Ctx>, OFctr<'a, Ctx, Self>: Factory<'a, Ctx>,
Self::Mtbl: MentionableTop<'a, Ctx>,
{ {
let origin_r = self.clone(); let origin_r = self.clone();
let origin_rb = self.clone(); let origin_rb = self.clone();