Struct glib::signal::SignalHandlerId [−][src]
pub struct SignalHandlerId(_);
Expand description
The id of a signal that is returned by connect
.
This type does not implement Clone
to prevent disconnecting
the same signal handler multiple times.
ⓘ
use glib::SignalHandlerId; use gtk::prelude::*; use std::cell::RefCell; struct Button { widget: gtk::Button, clicked_handler_id: RefCell<Option<SignalHandlerId>>, } impl Button { fn new() -> Self { let widget = gtk::Button::new(); let clicked_handler_id = RefCell::new(Some(widget.connect_clicked(|_button| { // Do something. }))); Self { widget, clicked_handler_id, } } fn disconnect(&self) { if let Some(id) = self.clicked_handler_id.borrow_mut().take() { self.widget.disconnect(id) } } }
Implementations
Trait Implementations
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl RefUnwindSafe for SignalHandlerId
impl Send for SignalHandlerId
impl Sync for SignalHandlerId
impl Unpin for SignalHandlerId
impl UnwindSafe for SignalHandlerId