EmptyInject
This commit is contained in:
parent
bab0b4169e
commit
f6cc23ff5f
@ -7,7 +7,7 @@ use sha2::{Digest, Sha256};
|
|||||||
|
|
||||||
use crate::func::{context::FunctorContext, *};
|
use crate::func::{context::FunctorContext, *};
|
||||||
use crate::rcore::*;
|
use crate::rcore::*;
|
||||||
use crate::rstd::{cast::*, typeless::*};
|
use crate::rstd::{cast::*, inject::*, typeless::*};
|
||||||
|
|
||||||
pub struct NoDiagnostic;
|
pub struct NoDiagnostic;
|
||||||
|
|
||||||
@ -92,9 +92,16 @@ impl<'a> Resolver<'a, TestContextPlain> for EmptyResolver {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn reparse<'a, A: Mentionable<'a, TestContextPlain>>(mentionable: Rc<A>) -> A {
|
struct EmptyInject;
|
||||||
let factory = mentionable.factory();
|
|
||||||
TypelessMentionable::from_typed(mentionable)
|
impl<'a, Ctx: Context<'a>> Inject<'a, Ctx> for EmptyInject {
|
||||||
.cast(factory)
|
fn inject<A: 'a>(&self, fa: Wrapped<'a, Ctx, A>) -> Wrapped<'a, Ctx, A> {
|
||||||
.expect("cast failed")
|
fa
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn reparse<'a, A: Mentionable<'a, TestContextPlain>>(mentionable: Rc<A>) -> A {
|
||||||
|
Rc::new(EmptyInject)
|
||||||
|
.inject_mentionable(mentionable.as_ref())
|
||||||
|
.expect("re-parsing failed")
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ use std::cmp::max;
|
|||||||
|
|
||||||
use crate::func::{context::*, *};
|
use crate::func::{context::*, *};
|
||||||
use crate::rcore::*;
|
use crate::rcore::*;
|
||||||
use crate::rstd::inject::*;
|
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user