1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
use std::ptr; #[derive(PartialEq, Debug)] pub struct Node<T> { pub next: *mut Node<T>, // 8 bytes pub payload: T, // size_of::<T>() bytes } impl<T> Node<T> { pub fn new(payload: T) -> Self { Self { next: ptr::null_mut(), payload, } } }