From 83a09501538534bb5cdaa54aee1cfc302f63e269 Mon Sep 17 00:00:00 2001 From: John Doty Date: Tue, 20 Jun 2023 06:17:34 -0700 Subject: [PATCH] [oden-js] TryFromValue for Value --- oden-js/src/conversion/from.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) 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)) + } +}