use std::pin::Pin; use std::task::{Context, Poll};
/// This adapts from `hyper` IO traits to the ones in Tokio. /// /// This is currently used by `h2`, and by hyper internal unit tests. #[derive(Debug)] pub(crate) struct Compat<T>(pub(crate) T);
fn p(self: Pin<&mutSelf>) -> Pin<&mut T> { // SAFETY: The simplest of projections. This is just // a wrapper, we don't do anything that would undo the projection. unsafe { self.map_unchecked_mut(|me| &mut me.0) }
}
}
impl<T> tokio::io::AsyncRead for Compat<T> where
T: crate::rt::Read,
{ fn poll_read( self: Pin<&mutSelf>,
cx: &mut Context<'_>,
tbuf: &mut tokio::io::ReadBuf<'_>,
) -> Poll<Result<(), std::io::Error>> { let init = tbuf.initialized().len(); let filled = tbuf.filled().len(); let (new_init, new_filled) = unsafe { letmut buf = crate::rt::ReadBuf::uninit(tbuf.inner_mut());
buf.set_init(init);
buf.set_filled(filled);
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.