pub struct Immediate<S>(pub S);Expand description
Presents a synchronous ObjectSource as an AsyncObjectSource whose
futures are already complete.
Wrapping a source in Immediate is what lets the synchronous entry points
share the asynchronous implementation. Because every future this produces
is std::future::Ready, a future tree built over it completes on its
first poll and never parks — see block_on.
Note the divergence from a genuinely asynchronous source: these futures do
their work eagerly, when the method is called, rather than lazily on first
poll. Constructing one and dropping it unpolled still performs the read.
That is invisible to an algorithm that awaits what it constructs, but it
means Immediate is not a timing-faithful stand-in for a streaming source.
Tuple Fields§
§0: STrait Implementations§
Source§impl<S: ObjectSource> AsyncObjectSource for Immediate<S>
impl<S: ObjectSource> AsyncObjectSource for Immediate<S>
impl<S: Copy> Copy for Immediate<S>
Auto Trait Implementations§
impl<S> Freeze for Immediate<S>where
S: Freeze,
impl<S> RefUnwindSafe for Immediate<S>where
S: RefUnwindSafe,
impl<S> Send for Immediate<S>where
S: Send,
impl<S> Sync for Immediate<S>where
S: Sync,
impl<S> Unpin for Immediate<S>where
S: Unpin,
impl<S> UnsafeUnpin for Immediate<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for Immediate<S>where
S: UnwindSafe,
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