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 automatically