pub struct Async<'l, F: AsFd> {
fd: Option<F>,
dispatcher: Rc<RefCell<IoDispatcher>>,
inner: Rc<dyn IoLoopInner + 'l>,
was_nonblocking: bool,
}
Expand description
Adapter for async IO manipulations
This type wraps an IO object, providing methods to create futures waiting for its readiness.
If the futures-io
cargo feature is enabled, it also implements AsyncRead
and/or
AsyncWrite
if the underlying type implements Read
and/or Write
.
Note that this adapter and the futures procuded from it and not threadsafe.
§Platform-Specific
- Windows: Usually, on drop, the file descriptor is set back to its previous status. For example, if the file was previously nonblocking it will be set to nonblocking, and if the file was blocking it will be set to blocking. However, on Windows, it is impossible to tell what its status was before. Therefore it will always be set to blocking.
Fields§
§fd: Option<F>
§dispatcher: Rc<RefCell<IoDispatcher>>
§inner: Rc<dyn IoLoopInner + 'l>
§was_nonblocking: bool
Implementations§
source§impl<'l, F: AsFd> Async<'l, F>
impl<'l, F: AsFd> Async<'l, F>
pub(crate) fn new<Data>( inner: Rc<LoopInner<'l, Data>>, fd: F, ) -> Result<Async<'l, F>>
sourcepub fn readable<'s>(&'s mut self) -> Readable<'s, 'l, F> ⓘ
pub fn readable<'s>(&'s mut self) -> Readable<'s, 'l, F> ⓘ
A future that resolves once the object becomes ready for reading
sourcepub fn writable<'s>(&'s mut self) -> Writable<'s, 'l, F> ⓘ
pub fn writable<'s>(&'s mut self) -> Writable<'s, 'l, F> ⓘ
A future that resolves once the object becomes ready for writing
sourcepub fn into_inner(self) -> F
pub fn into_inner(self) -> F
Remove the async adapter and retrieve the underlying object
fn readiness(&self) -> Readiness
fn register_waker(&self, interest: Interest, waker: Waker) -> Result<()>
Trait Implementations§
impl<'l, F: AsFd> Unpin for Async<'l, F>
Auto Trait Implementations§
impl<'l, F> Freeze for Async<'l, F>where
F: Freeze,
impl<'l, F> !RefUnwindSafe for Async<'l, F>
impl<'l, F> !Send for Async<'l, F>
impl<'l, F> !Sync for Async<'l, F>
impl<'l, F> !UnwindSafe for Async<'l, F>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more