diff --git a/oden-js/src/conversion/from.rs b/oden-js/src/conversion/from.rs index 4d12e776..d7a6acb4 100644 --- a/oden-js/src/conversion/from.rs +++ b/oden-js/src/conversion/from.rs @@ -1,4 +1,4 @@ -use crate::{ContextRef, Error, Result, ValueRef}; +use crate::{ContextRef, Error, Result, Value, ValueRef}; use std::num::TryFromIntError; pub trait TryFromValue: Sized { @@ -98,10 +98,9 @@ impl TryFromValue for String { } } -// impl<'c, T: Class> TryFrom<&'c ValueRef<'_>> for T { -// -// #[inline] -// fn try_from_value(value: &ValueRef, ctx:&ContextRef) -> Result< Self> { -// T::from_value(value) -// } -// } +impl TryFromValue for Value { + #[inline] + fn try_from_value(value: &ValueRef, ctx: &ContextRef) -> Result { + Ok(value.dup(ctx)) + } +}