ScopedConnection

Type Alias ScopedConnection 

Source
pub type ScopedConnection = ConnectionImpl<true>;
Expand description

Scoped connections are identical to regular connections, except that they will automcatically disconnect themselves when dropped.

See ConnectionImpl for details on the various functions implemented by scoped connections.

use signals2::*;
 
let sig: Signal<(), i32> = Signal::new();
{
   let _conn = sig.connect(|| 4).scoped(); // create a scoped connection
   assert_eq!(sig.emit(), Some(4));
}
 
assert_eq!(sig.emit(), None);

Aliased Typeยง

pub struct ScopedConnection { /* private fields */ }