SHARE
TWEET

Untitled

a guest Aug 20th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. use std::mem::size_of;
  2.  
  3. struct SymbolRef {
  4.     n: core::num::NonZeroUsize,
  5. }
  6.  
  7. struct BadSymbolRef {
  8.     n: usize,
  9. }
  10.  
  11. fn main() {
  12.     println!("usize: {}", size_of::<usize>());
  13.     println!("SymbolRef: {}", size_of::<SymbolRef>());
  14.     println!("Option<SymbolRef>: {}", size_of::<Option<SymbolRef>>());
  15.     println!("BadSymbolRef: {}", size_of::<BadSymbolRef>());
  16.     println!("Option<BadSymbolRef>: {}", size_of::<Option<BadSymbolRef>>());
  17. }
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
 
Top