Enum tvm_rt::RetValue [−][src]
pub enum RetValue {
Show 15 variants
Int(i64),
UInt(i64),
Float(f64),
Null,
DataType(DLDataType),
String(*mut i8),
Device(DLDevice),
Handle(*mut c_void),
ArrayHandle(*mut DLTensor),
ObjectHandle(*mut c_void),
ModuleHandle(*mut c_void),
FuncHandle(*mut c_void),
NDArrayHandle(*mut c_void),
Bytes(TVMByteArray),
Str(&'static CStr),
}
Expand description
An owned TVMPODValue. Can be converted from a variety of primitive and object types.
Can be downcasted using try_from
if it contains the desired type.
Example
use std::convert::{TryFrom, TryInto};
use tvm_sys::RetValue;
let a = 42u32;
let b: u32 = tvm_sys::RetValue::from(a).try_into().unwrap();
let s = "hello, world!";
let t: RetValue = s.to_string().into();
assert_eq!(String::try_from(t).unwrap(), s);
Variants
Int(i64)
Tuple Fields
0: i64
UInt(i64)
Tuple Fields
0: i64
Float(f64)
Tuple Fields
0: f64
Null
DataType(DLDataType)
Tuple Fields
0: DLDataType
String(*mut i8)
Device(DLDevice)
Tuple Fields
0: DLDevice
Handle(*mut c_void)
ArrayHandle(*mut DLTensor)
ObjectHandle(*mut c_void)
ModuleHandle(*mut c_void)
FuncHandle(*mut c_void)
NDArrayHandle(*mut c_void)
Bytes(TVMByteArray)
Tuple Fields
0: TVMByteArray
Str(&'static CStr)
Tuple Fields
0: &'static CStr
Implementations
Trait Implementations
Performs the conversion.
Performs the conversion.
type Error = ValueDowncastError
type Error = ValueDowncastError
The type returned in the event of a conversion error.
pub fn try_from(
val: RetValue
) -> Result<DLDataType, <DLDataType as TryFrom<RetValue>>::Error>
pub fn try_from(
val: RetValue
) -> Result<DLDataType, <DLDataType as TryFrom<RetValue>>::Error>
Performs the conversion.
type Error = ValueDowncastError
type Error = ValueDowncastError
The type returned in the event of a conversion error.
pub fn try_from(
val: RetValue
) -> Result<TVMByteArray, <TVMByteArray as TryFrom<RetValue>>::Error>
pub fn try_from(
val: RetValue
) -> Result<TVMByteArray, <TVMByteArray as TryFrom<RetValue>>::Error>
Performs the conversion.
Auto Trait Implementations
impl RefUnwindSafe for RetValue
impl UnwindSafe for RetValue
Blanket Implementations
Mutably borrows from an owned value. Read more