pub struct Any { /* private fields */ }Expand description
Managed Any that can hold reference to values
Implementations§
Source§impl Any
impl Any
pub fn new() -> Self
pub fn type_index(&self) -> i32
Sourcepub fn try_as<T>(&self) -> Option<T>where
T: AnyCompatible,
pub fn try_as<T>(&self) -> Option<T>where
T: AnyCompatible,
Try to query if stored typed in Any exactly matches the type T
This function is fast in the case of failure and can be used to check if the type is compatible with T
This function will not try to cast the type
and ensures invariance that the return value is only Some(T)
Any::from(T) contains exactly the same value value
Any::try_as<T>() contains exactly the same value value
will return Some(T) if the type is exactly compatible with T will return None if the type is not compatible with T
pub unsafe fn as_data_ptr(&mut self) -> *mut TVMFFIAny
pub unsafe fn into_raw_ffi_any(this: Self) -> TVMFFIAny
pub unsafe fn from_raw_ffi_any(data: TVMFFIAny) -> Self
Sourcepub fn debug_strong_count(&self) -> Option<usize>
pub fn debug_strong_count(&self) -> Option<usize>
Get the strong count of the underlying object for testing/debugging purposes
If the underlying object is not ref counted, return None
Trait Implementations§
Source§impl<T: AnyCompatible> From<T> for Any
impl<T: AnyCompatible> From<T> for Any
Source§impl TryFrom<Any> for DLDataType
impl TryFrom<Any> for DLDataType
Source§impl<T: AnyCompatible> TryFrom<Any> for TryFromTemp<T>
impl<T: AnyCompatible> TryFrom<Any> for TryFromTemp<T>
Auto Trait Implementations§
impl Freeze for Any
impl RefUnwindSafe for Any
impl !Send for Any
impl !Sync for Any
impl Unpin for Any
impl UnsafeUnpin for Any
impl UnwindSafe for Any
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more