pub struct EventHandle<T: ?Sized> { /* private fields */ }Expand description
Handle returned when registering callbacks.
Automatically unregisters the callback when dropped, implementing RAII cleanup pattern to prevent memory leaks.
§Examples
use telegram_webapp_sdk::TelegramWebApp;
if let Some(app) = TelegramWebApp::instance() {
// Handle is automatically cleaned up when scope ends
let handle = app
.on_theme_changed(|| {
println!("Theme changed!");
})
.expect("subscribe");
// No manual cleanup needed - Drop handles it
} // <- handle dropped here, callback unregistered automaticallyTrait Implementations§
Source§impl<T: ?Sized> Drop for EventHandle<T>
impl<T: ?Sized> Drop for EventHandle<T>
Auto Trait Implementations§
impl<T> Freeze for EventHandle<T>where
T: ?Sized,
impl<T> RefUnwindSafe for EventHandle<T>where
T: RefUnwindSafe + ?Sized,
impl<T> !Send for EventHandle<T>
impl<T> !Sync for EventHandle<T>
impl<T> Unpin for EventHandle<T>where
T: ?Sized,
impl<T> UnwindSafe for EventHandle<T>where
T: UnwindSafe + ?Sized,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more