pub struct Inspector { /* private fields */ }Expand description
A collector for stream data, inspecting it chunk by chunk.
See the inspect_* functions on BroadcastOutputStream and SingleOutputStream.
For proper cleanup, call
wait(), which waits for the collection task to complete.cancel(), which sends a termination signal and then waits for the collection task to complete.
If not cleaned up, the termination signal will be sent when dropping this collector, but the task will be aborted (forceful, not waiting for its regular completion).
Implementations§
Source§impl Inspector
impl Inspector
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Checks if this task has finished.
Sourcepub async fn wait(self) -> Result<(), InspectorError>
pub async fn wait(self) -> Result<(), InspectorError>
Wait for the inspector to terminate naturally.
An inspector will automatically terminate when either:
- The underlying write-side of the stream is dropped.
- The underlying stream is closed (by receiving an EOF / final read of 0 bytes).
- The first
Next::Breakis observed.
If none of these may occur in your case, this could/will hang forever!
Sourcepub async fn cancel(self) -> Result<(), InspectorError>
pub async fn cancel(self) -> Result<(), InspectorError>
Sends a cancellation event to the inspector, letting it shut down.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Inspector
impl !RefUnwindSafe for Inspector
impl Send for Inspector
impl Sync for Inspector
impl Unpin for Inspector
impl !UnwindSafe for Inspector
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