pub struct AssertUnmoved<T> { /* private fields */ }Expand description
A type that asserts that the underlying type is not moved after being pinned and mutably accessed.
See crate level documentation for details.
Implementations§
Source§impl<T> AssertUnmoved<T>
impl<T> AssertUnmoved<T>
Sourcepub fn get_mut(&mut self) -> &mut T
pub fn get_mut(&mut self) -> &mut T
Gets a mutable reference to the underlying type.
Note that this method can only be called before pinned since
AssertUnmoved is !Unpin (this is guaranteed by the type system!).
§Panics
Panics if this AssertUnmoved moved after being pinned and mutably accessed.
Sourcepub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut T>
pub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut T>
Gets a pinned mutable reference to the underlying type.
§Panics
Panics if this AssertUnmoved moved after being pinned and mutably accessed.
§Examples
Implement own Stream trait for AssertUnmoved.
use std::{
pin::Pin,
task::{Context, Poll},
};
use assert_unmoved::AssertUnmoved;
pub trait MyStream {
type Item;
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>>;
}
impl<S: MyStream> MyStream for AssertUnmoved<S> {
type Item = S::Item;
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
self.get_pin_mut().poll_next(cx)
}
}Trait Implementations§
Source§impl<R: AsyncBufRead> AsyncBufRead for AssertUnmoved<R>
Available on crate feature futures03 only.
impl<R: AsyncBufRead> AsyncBufRead for AssertUnmoved<R>
futures03 only.Source§impl<R: AsyncBufRead> AsyncBufRead for AssertUnmoved<R>
Available on crate feature tokio02 only.
impl<R: AsyncBufRead> AsyncBufRead for AssertUnmoved<R>
tokio02 only.Source§impl<R: AsyncBufRead> AsyncBufRead for AssertUnmoved<R>
Available on crate feature tokio03 only.
impl<R: AsyncBufRead> AsyncBufRead for AssertUnmoved<R>
tokio03 only.Source§impl<R: AsyncBufRead> AsyncBufRead for AssertUnmoved<R>
Available on crate feature tokio1 only.
impl<R: AsyncBufRead> AsyncBufRead for AssertUnmoved<R>
tokio1 only.Source§impl<R: AsyncRead> AsyncRead for AssertUnmoved<R>
Available on crate feature futures03 only.
impl<R: AsyncRead> AsyncRead for AssertUnmoved<R>
futures03 only.Source§impl<R: AsyncRead> AsyncRead for AssertUnmoved<R>
Available on crate feature tokio02 only.
impl<R: AsyncRead> AsyncRead for AssertUnmoved<R>
tokio02 only.Source§unsafe fn prepare_uninitialized_buffer(
&self,
buf: &mut [MaybeUninit<u8>],
) -> bool
unsafe fn prepare_uninitialized_buffer( &self, buf: &mut [MaybeUninit<u8>], ) -> bool
read. Returns
true if the supplied buffer was zeroed out. Read moreSource§impl<R: AsyncRead> AsyncRead for AssertUnmoved<R>
Available on crate feature tokio03 only.
impl<R: AsyncRead> AsyncRead for AssertUnmoved<R>
tokio03 only.Source§impl<R: AsyncRead> AsyncRead for AssertUnmoved<R>
Available on crate feature tokio1 only.
impl<R: AsyncRead> AsyncRead for AssertUnmoved<R>
tokio1 only.Source§impl<S: AsyncSeek> AsyncSeek for AssertUnmoved<S>
Available on crate feature futures03 only.
impl<S: AsyncSeek> AsyncSeek for AssertUnmoved<S>
futures03 only.Source§impl<S: AsyncSeek> AsyncSeek for AssertUnmoved<S>
Available on crate feature tokio02 only.
impl<S: AsyncSeek> AsyncSeek for AssertUnmoved<S>
tokio02 only.Source§impl<S: AsyncSeek> AsyncSeek for AssertUnmoved<S>
Available on crate feature tokio03 only.
impl<S: AsyncSeek> AsyncSeek for AssertUnmoved<S>
tokio03 only.Source§impl<S: AsyncSeek> AsyncSeek for AssertUnmoved<S>
Available on crate feature tokio1 only.
impl<S: AsyncSeek> AsyncSeek for AssertUnmoved<S>
tokio1 only.Source§impl<W: AsyncWrite> AsyncWrite for AssertUnmoved<W>
Available on crate feature futures03 only.
impl<W: AsyncWrite> AsyncWrite for AssertUnmoved<W>
futures03 only.Source§fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8],
) -> Poll<Result<usize>>
fn poll_write( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize>>
buf into the object. Read moreSource§fn poll_write_vectored(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
bufs: &[IoSlice<'_>],
) -> Poll<Result<usize>>
fn poll_write_vectored( self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &[IoSlice<'_>], ) -> Poll<Result<usize>>
bufs into the object using vectored
IO operations. Read moreSource§impl<W: AsyncWrite> AsyncWrite for AssertUnmoved<W>
Available on crate feature tokio02 only.
impl<W: AsyncWrite> AsyncWrite for AssertUnmoved<W>
tokio02 only.Source§fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8],
) -> Poll<Result<usize>>
fn poll_write( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize>>
buf into the object. Read moreSource§fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
Source§impl<W: AsyncWrite> AsyncWrite for AssertUnmoved<W>
Available on crate feature tokio03 only.
impl<W: AsyncWrite> AsyncWrite for AssertUnmoved<W>
tokio03 only.Source§fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8],
) -> Poll<Result<usize>>
fn poll_write( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize>>
buf into the object. Read moreSource§fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
Source§fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
Source§fn poll_write_vectored(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
bufs: &[IoSlice<'_>],
) -> Poll<Result<usize, Error>>
fn poll_write_vectored( self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &[IoSlice<'_>], ) -> Poll<Result<usize, Error>>
poll_write, except that it writes from a slice of buffers. Read moreSource§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
poll_write_vectored
implementation. Read moreSource§impl<W: AsyncWrite> AsyncWrite for AssertUnmoved<W>
Available on crate feature tokio1 only.
impl<W: AsyncWrite> AsyncWrite for AssertUnmoved<W>
tokio1 only.Source§fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8],
) -> Poll<Result<usize>>
fn poll_write( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize>>
buf into the object. Read moreSource§fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
Source§fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
Source§fn poll_write_vectored(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
bufs: &[IoSlice<'_>],
) -> Poll<Result<usize, Error>>
fn poll_write_vectored( self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &[IoSlice<'_>], ) -> Poll<Result<usize, Error>>
poll_write, except that it writes from a slice of buffers. Read moreSource§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
poll_write_vectored
implementation. Read moreSource§impl<T: Debug> Debug for AssertUnmoved<T>
impl<T: Debug> Debug for AssertUnmoved<T>
Source§impl<T: Default> Default for AssertUnmoved<T>
impl<T: Default> Default for AssertUnmoved<T>
Source§fn default() -> Self
fn default() -> Self
Creates a new AssertUnmoved, with the default value for T.
This is equivalent to AssertUnmoved::new(T::default()).
Source§impl<T> Deref for AssertUnmoved<T>
impl<T> Deref for AssertUnmoved<T>
Source§impl<T> Drop for AssertUnmoved<T>
impl<T> Drop for AssertUnmoved<T>
Source§impl<T> From<T> for AssertUnmoved<T>
impl<T> From<T> for AssertUnmoved<T>
Source§fn from(inner: T) -> Self
fn from(inner: T) -> Self
Converts a T into a AssertUnmoved<T>.
This is equivalent to AssertUnmoved::new.
Source§impl<F: FusedFuture> FusedFuture for AssertUnmoved<F>
Available on crate feature futures03 only.
impl<F: FusedFuture> FusedFuture for AssertUnmoved<F>
futures03 only.Source§fn is_terminated(&self) -> bool
fn is_terminated(&self) -> bool
true if the underlying future should no longer be polled.Source§impl<S: FusedStream> FusedStream for AssertUnmoved<S>
Available on crate feature futures03 only.
impl<S: FusedStream> FusedStream for AssertUnmoved<S>
futures03 only.Source§fn is_terminated(&self) -> bool
fn is_terminated(&self) -> bool
true if the stream should no longer be polled.Source§impl<F: Future> Future for AssertUnmoved<F>
impl<F: Future> Future for AssertUnmoved<F>
Source§impl<S: Sink<Item>, Item> Sink<Item> for AssertUnmoved<S>
Available on crate feature futures03 only.
impl<S: Sink<Item>, Item> Sink<Item> for AssertUnmoved<S>
futures03 only.Source§type Error = <S as Sink<Item>>::Error
type Error = <S as Sink<Item>>::Error
Source§fn poll_ready(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>>
fn poll_ready( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>
Sink to receive a value. Read moreSource§fn start_send(self: Pin<&mut Self>, item: Item) -> Result<(), Self::Error>
fn start_send(self: Pin<&mut Self>, item: Item) -> Result<(), Self::Error>
poll_ready which returned Poll::Ready(Ok(())). Read moreSource§impl<S: Stream> Stream for AssertUnmoved<S>
Available on crate feature futures03 only.
impl<S: Stream> Stream for AssertUnmoved<S>
futures03 only.