Enum tvm::runtime::function::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: i64UInt(i64)
Tuple Fields
0: i64Float(f64)
Tuple Fields
0: f64Null
DataType(DLDataType)
Tuple Fields
0: DLDataTypeString(*mut i8)
Device(DLDevice)
Tuple Fields
0: DLDeviceHandle(*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: TVMByteArrayStr(&'static CStr)
Tuple Fields
0: &'static CStrImplementations
Trait Implementations
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
pub fn into_raw(
self
) -> *mut <fn(Vec<ArgValue<'arg>, Global>) -> Result<RetValue, Error> as ToFunction<RawArgs, RetValue>>::Handle
pub fn call(
handle: *mut <fn(Vec<ArgValue<'arg>, Global>) -> Result<RetValue, Error> as ToFunction<RawArgs, RetValue>>::Handle,
args: Vec<ArgValue<'arg>, Global>
) -> Result<RetValue, Error>
pub fn drop(
*mut <fn(Vec<ArgValue<'arg>, Global>) -> Result<RetValue, Error> as ToFunction<RawArgs, RetValue>>::Handle
)
The callback function which is wrapped converted by TVM into a packed function stored in fhandle. Read more
The finalizer which is invoked when the packed function’s reference count is zero. Read more
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.
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.
Auto Trait Implementations
impl RefUnwindSafe for RetValue
impl UnwindSafe for RetValue
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more
