[oden-js] TryFromValue for Value

This commit is contained in:
John Doty 2023-06-20 06:17:34 -07:00
parent a48a9efdb4
commit 83a0950153

View file

@ -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<Self> {
Ok(value.dup(ctx))
}
}