use oneshot::{Receiver, Sender}; use std::mem; /// Just sanity check that both channel endpoints stay the size of a single pointer. #[test] fn channel_endpoints_single_pointer() { const PTR_SIZE: usize = mem::size_of::<*const ()>(); assert_eq!(mem::size_of::>(), PTR_SIZE); assert_eq!(mem::size_of::>(), PTR_SIZE); assert_eq!(mem::size_of::>(), PTR_SIZE); assert_eq!(mem::size_of::>(), PTR_SIZE); assert_eq!(mem::size_of::>(), PTR_SIZE); assert_eq!(mem::size_of::>(), PTR_SIZE); assert_eq!(mem::size_of::>>(), PTR_SIZE); assert_eq!(mem::size_of::>>(), PTR_SIZE); } /// Check that the `SendError` stays small. Useful to automatically detect if it is refactored /// to become large. We do not want the stack requirement for calling `Sender::send` to grow. #[test] fn error_sizes() { const PTR_SIZE: usize = mem::size_of::(); assert_eq!(mem::size_of::>(), PTR_SIZE); assert_eq!(mem::size_of::>(), PTR_SIZE); assert_eq!(mem::size_of::>(), PTR_SIZE); // The type returned from `Sender::send` is also just pointer sized assert_eq!( mem::size_of::>>(), PTR_SIZE ); }