Skip to content

Instantly share code, notes, and snippets.

@rust-play
Created August 22, 2019 07:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rust-play/99fda6749992024550ff2142e2207c7a to your computer and use it in GitHub Desktop.
Save rust-play/99fda6749992024550ff2142e2207c7a to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
use std::mem::size_of;
use std::num::NonZeroI8;
fn main() {
println!("i8: {}, nonzero i8: {}", size_of::<Option<i8>>(), size_of::<Option<NonZeroI8>>());
println!("vec: {}, option: {}", size_of::<Vec<u8>>(), size_of::<Option<Vec<u8>>>());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment