[oden-js] TryFromValue for Value
This commit is contained in:
parent
a48a9efdb4
commit
83a0950153
1 changed files with 7 additions and 8 deletions
|
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue