From d9a2a77a19e56edd8eb96eba002e39bc7be3bde3 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Thu, 11 Apr 2019 20:45:43 +0200 Subject: Thread lifetimes through other newtypes Closes #55 --- dhall/src/traits/dynamic_type.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'dhall/src/traits/dynamic_type.rs') diff --git a/dhall/src/traits/dynamic_type.rs b/dhall/src/traits/dynamic_type.rs index d03f8cd..28ed76d 100644 --- a/dhall/src/traits/dynamic_type.rs +++ b/dhall/src/traits/dynamic_type.rs @@ -6,17 +6,17 @@ use dhall_core::{Const, ExprF}; use std::borrow::Cow; pub trait DynamicType { - fn get_type<'a>(&'a self) -> Result, TypeError>; + fn get_type<'a>(&'a self) -> Result>, TypeError>; } impl DynamicType for T { - fn get_type<'a>(&'a self) -> Result, TypeError> { + fn get_type<'a>(&'a self) -> Result>, TypeError> { Ok(Cow::Owned(T::get_static_type())) } } -impl DynamicType for Type { - fn get_type(&self) -> Result, TypeError> { +impl<'a> DynamicType for Type<'a> { + fn get_type(&self) -> Result>, TypeError> { use TypeInternal::*; match &self.0 { Expr(e) => e.get_type(), @@ -29,8 +29,8 @@ impl DynamicType for Type { } } -impl DynamicType for Normalized { - fn get_type(&self) -> Result, TypeError> { +impl<'a> DynamicType for Normalized<'a> { + fn get_type(&self) -> Result>, TypeError> { match &self.1 { Some(t) => Ok(Cow::Borrowed(t)), None => Err(TypeError::new( @@ -42,8 +42,8 @@ impl DynamicType for Normalized { } } -impl DynamicType for Typed { - fn get_type(&self) -> Result, TypeError> { +impl<'a> DynamicType for Typed<'a> { + fn get_type(&self) -> Result>, TypeError> { match &self.1 { Some(t) => Ok(Cow::Borrowed(t)), None => Err(TypeError::new( -- cgit v1.2.3