diff options
author | Nadrieril | 2019-04-12 16:33:49 +0200 |
---|---|---|
committer | Nadrieril | 2019-04-12 16:33:49 +0200 |
commit | 35e19e0f7c3dcfcd4203a3aaaa73d6f26db276f5 (patch) | |
tree | da5c9d6e936ba97d7ccadc213ea2c5a197ebe15b /dhall/src/traits/dynamic_type.rs | |
parent | 7ba857a96eebbdd1cef0aa22407c870887d24aed (diff) | |
parent | 5fcc7f69c7a68b08ff223217e8af9f8edb2cc761 (diff) |
Merge branch 'lifetimes'
Closes #55
Diffstat (limited to 'dhall/src/traits/dynamic_type.rs')
-rw-r--r-- | dhall/src/traits/dynamic_type.rs | 16 |
1 files changed, 8 insertions, 8 deletions
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<Cow<'a, Type>, TypeError>; + fn get_type<'a>(&'a self) -> Result<Cow<'a, Type<'static>>, TypeError>; } impl<T: StaticType> DynamicType for T { - fn get_type<'a>(&'a self) -> Result<Cow<'a, Type>, TypeError> { + fn get_type<'a>(&'a self) -> Result<Cow<'a, Type<'static>>, TypeError> { Ok(Cow::Owned(T::get_static_type())) } } -impl DynamicType for Type { - fn get_type(&self) -> Result<Cow<'_, Type>, TypeError> { +impl<'a> DynamicType for Type<'a> { + fn get_type(&self) -> Result<Cow<'_, Type<'static>>, 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<Cow<'_, Type>, TypeError> { +impl<'a> DynamicType for Normalized<'a> { + fn get_type(&self) -> Result<Cow<'_, Type<'static>>, 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<Cow<'_, Type>, TypeError> { +impl<'a> DynamicType for Typed<'a> { + fn get_type(&self) -> Result<Cow<'_, Type<'static>>, TypeError> { match &self.1 { Some(t) => Ok(Cow::Borrowed(t)), None => Err(TypeError::new( |