SHARE
TWEET

Untitled

a guest Sep 18th, 2019 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. use std::sync::Arc;
  2.  
  3. const CUTOFF: usize = std::mem::size_of::<&[u8]>() - 1;
  4.  
  5. type Inner = [u8; CUTOFF];
  6.  
  7. pub struct IVec(IVecInner);
  8.  
  9. enum IVecInner {
  10.     Inline(u8, Inner),
  11.     Remote(Arc<[u8]>),
  12. }
  13.  
  14. struct Inline(u8, Inner);
  15.  
  16. fn main() {
  17.     dbg!(std::mem::size_of::<Inline>());
  18.     dbg!(std::mem::size_of::<IVec>());
  19. }
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