cast_error
				
					
				
			This commit is contained in:
		
							parent
							
								
									be427e4e87
								
							
						
					
					
						commit
						f08b7d3c7a
					
				@ -169,20 +169,33 @@ impl<'a, Ctx: CastCtx<'a>> TypelessMentionable<'a, Ctx> {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn cast_resolve<'a, Ctx: CastCtx<'a>, A: Mentionable<'a, Ctx>>(
 | 
			
		||||
    typeless_origin: Rc<dyn Origin<'a, Ctx, Mtbl = TypelessMentionable<'a, Ctx>>>,
 | 
			
		||||
fn cast_error<'a, Ctx: CastCtx<'a>, A: Mentionable<'a, Ctx>>(
 | 
			
		||||
    error: ResolutionFailure<'a, Ctx, TypelessMentionable<'a, Ctx>>,
 | 
			
		||||
) -> ResolutionFailure<'a, Ctx, A> {
 | 
			
		||||
    ResolutionError::Lookup(match error {
 | 
			
		||||
        ResolutionError::Lookup(lookup_error) => lookup_error,
 | 
			
		||||
        ResolutionError::Parse(parse_error) => Ctx::from_cast(CastError::Typeless(parse_error)),
 | 
			
		||||
    })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn cast_resolved<'a, Ctx: CastCtx<'a>, A: Mentionable<'a, Ctx>>(
 | 
			
		||||
    resolved: ResolutionResult<'a, Ctx, TypelessMentionable<'a, Ctx>>,
 | 
			
		||||
    factory: A::Fctr,
 | 
			
		||||
) -> Resolution<'a, Ctx, A> {
 | 
			
		||||
    typeless_origin.resolve_map(|resolved| match resolved {
 | 
			
		||||
) -> ResolutionResult<'a, Ctx, A> {
 | 
			
		||||
    match resolved {
 | 
			
		||||
        Ok(typeless_mentionable) => match typeless_mentionable.cast(factory) {
 | 
			
		||||
            Ok(mentionable) => Ok(Rc::new(mentionable)),
 | 
			
		||||
            Err(parse_error) => Err(ResolutionError::Parse(parse_error)),
 | 
			
		||||
        },
 | 
			
		||||
        Err(error) => Err(ResolutionError::Lookup(match error {
 | 
			
		||||
            ResolutionError::Lookup(lookup_error) => lookup_error,
 | 
			
		||||
            ResolutionError::Parse(parse_error) => Ctx::from_cast(CastError::Typeless(parse_error)),
 | 
			
		||||
        })),
 | 
			
		||||
    })
 | 
			
		||||
        Err(error) => Err(cast_error::<Ctx, A>(error)),
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn cast_resolve<'a, Ctx: CastCtx<'a>, A: Mentionable<'a, Ctx>>(
 | 
			
		||||
    typeless_origin: Rc<dyn Origin<'a, Ctx, Mtbl = TypelessMentionable<'a, Ctx>>>,
 | 
			
		||||
    factory: A::Fctr,
 | 
			
		||||
) -> Resolution<'a, Ctx, A> {
 | 
			
		||||
    typeless_origin.resolve_map(|resolved| cast_resolved(resolved, factory))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn cast_origin<'a, Ctx: CastCtx<'a>, A: Mentionable<'a, Ctx>>(
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user