Struct druid::piet::cairo::glib::SignalHandlerId
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.take() {
self.widget.disconnect(id)
}
}
}
Implementations§
§impl SignalHandlerId
impl SignalHandlerId
Trait Implementations§
§impl Debug for SignalHandlerId
impl Debug for SignalHandlerId
§impl FromGlib<u64> for SignalHandlerId
impl FromGlib<u64> for SignalHandlerId
unsafe fn from_glib(val: u64) -> SignalHandlerId
§impl PartialEq<SignalHandlerId> for SignalHandlerId
impl PartialEq<SignalHandlerId> for SignalHandlerId
§fn eq(&self, other: &SignalHandlerId) -> bool
fn eq(&self, other: &SignalHandlerId) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Eq for SignalHandlerId
impl StructuralEq for SignalHandlerId
impl StructuralPartialEq for SignalHandlerId
Auto Trait Implementations§
impl RefUnwindSafe for SignalHandlerId
impl Send for SignalHandlerId
impl Sync for SignalHandlerId
impl Unpin for SignalHandlerId
impl UnwindSafe for SignalHandlerId
Blanket Implementations§
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
§impl<T> RoundFrom<T> for T
impl<T> RoundFrom<T> for T
§fn round_from(x: T) -> T
fn round_from(x: T) -> T
Performs the conversion.
§impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
impl<T, U> RoundInto<U> for Twhere U: RoundFrom<T>,
§fn round_into(self) -> U
fn round_into(self) -> U
Performs the conversion.