GuardStreamExt

Trait GuardStreamExt 

Source
pub trait GuardStreamExt: Stream + Sized {
    // Required method
    fn guard<F>(self, on_drop: F) -> StreamGuard<Self, F>
       where F: FnOnce();
}
Expand description

A convenience extension for creating a StreamGuard via a method.

Required Methods§

Source

fn guard<F>(self, on_drop: F) -> StreamGuard<Self, F>
where F: FnOnce(),

Wraps the Stream, running the given closure upon being dropped.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<S> GuardStreamExt for S
where S: Stream + Sized,