Ver código fonte

docs: add comments for the Handler

Jonathan Kelley 3 anos atrás
pai
commit
036a0ff
1 arquivos alterados com 2 adições e 0 exclusões
  1. 2 0
      packages/core/src/nodes.rs

+ 2 - 0
packages/core/src/nodes.rs

@@ -357,12 +357,14 @@ pub struct EventHandler<'bump, T = ()> {
 }
 
 impl<T> EventHandler<'_, T> {
+    /// Call this event handler with the appropriate event type
     pub fn call(&self, event: T) {
         if let Some(callback) = self.callback.borrow_mut().as_mut() {
             callback(event);
         }
     }
 
+    /// Forcibly drop the internal handler callback, releasing memory
     pub fn release(&self) {
         self.callback.replace(None);
     }