SHARE
TWEET

Untitled

a guest Jul 21st, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. use std::any::{Any, TypeId};
  2.  
  3. struct Container<'a>{
  4.     value: &'a u32,
  5. }
  6.  
  7. fn main() {
  8.     let x = 10;
  9.    
  10.     let cont = Container{value: &x};
  11.    
  12.     let result =  TypeId::of::<Container<'_>>() == cont.type_id();
  13.     println!("Same type? {}", result);
  14. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top