add some docs

This commit is contained in:
Corwin Kuiper 2021-08-07 13:10:51 +01:00
parent c60eaaaff0
commit b559b0eb54

View file

@ -215,6 +215,8 @@ fn get_interrupt_handle_root<'a>(
} }
} }
/// The [add_interrupt_handler!] macro should be used instead of this function.
/// Creates an interrupt handler from a closure.
pub fn get_interrupt_handle( pub fn get_interrupt_handle(
f: &(dyn Fn(Key) + Send + Sync), f: &(dyn Fn(Key) + Send + Sync),
interrupt: Interrupt, interrupt: Interrupt,
@ -224,6 +226,9 @@ pub fn get_interrupt_handle(
get_interrupt_handle_root(f, root) get_interrupt_handle_root(f, root)
} }
/// The [add_interrupt_handler!] macro should be used instead of this.
/// Adds an interrupt handler to the interrupt table such that when that
/// interrupt is triggered the closure is called.
pub fn add_interrupt<'a>(interrupt: Pin<&'a InterruptClosureBounded<'a>>) { pub fn add_interrupt<'a>(interrupt: Pin<&'a InterruptClosureBounded<'a>>) {
let root = unsafe { &*interrupt.c.root }; let root = unsafe { &*interrupt.c.root };
root.add(); root.add();