pub trait DLDataTypeExt: Sized {
// Required methods
fn to_string(&self) -> String;
fn try_from_str(dtype_str: &str) -> Result<Self>;
}Expand description
Name conversions of a DLDataType.
Required Methods§
Sourcefn to_string(&self) -> String
fn to_string(&self) -> String
Return the name of the data type, such as "int32", "float64" or
"int8x4" (bits and lanes), the name every language uses for it, or
"dtype(code=.., bits=.., lanes=..)" for one the runtime cannot name.
use tvm_ffi::{DLDataType, DLDataTypeExt};
let dtype = DLDataType::try_from_str("float16")?;
assert_eq!(dtype.to_string(), "float16");Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".