Connection

Type Alias Connection 

Source
pub type Connection = ConnectionImpl<false>;
Expand description

A connection manages one slot for one particular signal. Connections carry no type information about their underlying signal. Connections are created when new slots are connected to a signal.

Note that when a connection is dropped it will not automatically disconnect its underlying slot. See ScopedConnection for a connection that automatically disconnects when dropped.

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

§Examples

use signals2::*;
 
let sig: Signal<(), i32> = Signal::new();
let conn = sig.connect(|| 4);
assert_eq!(sig.emit(), Some(4));
conn.disconnect(); // disconnect the slot
assert_eq!(sig.emit(), None);

Aliased Type§

pub struct Connection { /* private fields */ }