use futures::future::FutureExt; use std::alloc::Layout; use std::future::Future; use std::marker::PhantomPinned; use std::pin::Pin; use std::rc::Rc; use std::task::{Context, Poll}; use tokio_util::sync::ReusableBoxFuture;
#[test] // Clippy false positive; it's useful to be able to test the trait impls for any lifetime #[allow(clippy::extra_unused_lifetimes)] fn traits<'a>() { fn assert_traits<T: Send + Sync + Unpin>() {} // Use a type that is !Unpin
assert_traits::<ReusableBoxFuture<'a, PhantomPinned>>(); // Use a type that is !Send + !Sync
assert_traits::<ReusableBoxFuture<'a, Rc<()>>>();
}
#[test] fn test_different_futures() { let fut = asyncmove { 10 }; // Not zero sized!
assert_eq!(Layout::for_value(&fut).size(), 1);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.