aboutsummaryrefslogtreecommitdiff
path: root/syn/examples/heapsize/example
diff options
context:
space:
mode:
Diffstat (limited to 'syn/examples/heapsize/example')
-rw-r--r--syn/examples/heapsize/example/Cargo.toml9
-rw-r--r--syn/examples/heapsize/example/src/main.rs28
2 files changed, 0 insertions, 37 deletions
diff --git a/syn/examples/heapsize/example/Cargo.toml b/syn/examples/heapsize/example/Cargo.toml
deleted file mode 100644
index 85c7699..0000000
--- a/syn/examples/heapsize/example/Cargo.toml
+++ /dev/null
@@ -1,9 +0,0 @@
-[package]
-name = "heapsize_example"
-version = "0.0.0"
-authors = ["David Tolnay <dtolnay@gmail.com>"]
-edition = "2018"
-publish = false
-
-[dependencies]
-heapsize = { path = "../heapsize" }
diff --git a/syn/examples/heapsize/example/src/main.rs b/syn/examples/heapsize/example/src/main.rs
deleted file mode 100644
index 9332b11..0000000
--- a/syn/examples/heapsize/example/src/main.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-use heapsize::HeapSize;
-
-#[derive(HeapSize)]
-struct Demo<'a, T: ?Sized> {
- a: Box<T>,
- b: u8,
- c: &'a str,
- d: String,
-}
-
-fn main() {
- let demo = Demo {
- a: b"bytestring".to_vec().into_boxed_slice(),
- b: 255,
- c: "&'static str",
- d: "String".to_owned(),
- };
-
- // 10 + 0 + 0 + 6 = 16
- println!(
- "heap size = {} + {} + {} + {} = {}",
- demo.a.heap_size_of_children(),
- demo.b.heap_size_of_children(),
- demo.c.heap_size_of_children(),
- demo.d.heap_size_of_children(),
- demo.heap_size_of_children()
- );
-}