diff --git a/implementations/rust/oo/src/lib.rs b/implementations/rust/oo/src/lib.rs index 3e356ff..193b798 100644 --- a/implementations/rust/oo/src/lib.rs +++ b/implementations/rust/oo/src/lib.rs @@ -87,7 +87,7 @@ pub fn value>(v: &V) -> &dyn Value { v } -impl<'a, D: Domain> Value for &'a dyn Value { +impl<'a, D: Domain, V: Value + ?Sized> Value for &'a V { fn value_class(&self) -> ValueClass { (*self).value_class() } fn as_boolean(&self) -> Option { (*self).as_boolean() } fn as_float(&self) -> Option { (*self).as_float() } @@ -301,7 +301,7 @@ impl Value for Float { fn as_double(&self) -> Option { Some(self.0 as f64) } } -impl<'a, D: Domain> Value for &'a str { +impl Value for str { fn value_class(&self) -> ValueClass { ValueClass::Atomic(AtomClass::String) } fn as_string(&self) -> Option> { Some(Cow::Borrowed(self)) } } @@ -331,16 +331,6 @@ impl> Value for [V] { } } -impl<'v, D: Domain, V: Value> Value for &'v [V] { - fn value_class(&self) -> ValueClass { ValueClass::Compound(CompoundClass::Sequence) } - fn is_sequence(&self) -> bool { true } - fn len(&self) -> Option { Some((self as &[V]).len()) } - fn index(&self, i: usize) -> &dyn Value { &self[i] } - fn iter(&self) -> Option> + '_>> { - Some(Box::new(self[..].iter().map(value))) - } -} - impl Value for Set>> { fn value_class(&self) -> ValueClass { ValueClass::Compound(CompoundClass::Set) } fn is_set(&self) -> bool { true }