pub struct SourcePump { /* private fields */ }Expand description
Owns a source’s spawned reader task and aborts it on drop. Holds the pump+abort lifecycle so a transport author never re-derives it (the source-emit ruling — see the module docs / PROCESSOR-DESIGN §10 Q6).
Implementations§
Source§impl SourcePump
impl SourcePump
Sourcepub fn spawn<F, Fut>(head: UnboundedSender<Frame>, f: F) -> Self
pub fn spawn<F, Fut>(head: UnboundedSender<Frame>, f: F) -> Self
Spawn a source reader. f receives a SourceHandle and runs the
transport’s recv() loop, emiting frames into the pipeline head until the
transport is exhausted (then it should call SourceHandle::end). The
returned SourcePump aborts the reader on drop, so dropping it after
PipelineTask::run returns cleans the reader up.
Sourcepub fn from_handle(handle: JoinHandle<()>) -> Self
pub fn from_handle(handle: JoinHandle<()>) -> Self
Wrap an already-spawned reader handle (for sources that build their own
task — e.g. one that needs the JoinHandle before the loop body). The
reader is still expected to feed the head via a SourceHandle.
Trait Implementations§
Source§impl Drop for SourcePump
impl Drop for SourcePump
Auto Trait Implementations§
impl Freeze for SourcePump
impl RefUnwindSafe for SourcePump
impl Send for SourcePump
impl Sync for SourcePump
impl Unpin for SourcePump
impl UnsafeUnpin for SourcePump
impl UnwindSafe for SourcePump
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