fix doc example

This commit is contained in:
Corwin 2023-04-06 21:28:52 +01:00
parent 96a321504c
commit 686ded4377
No known key found for this signature in database

View file

@ -228,6 +228,7 @@ fn interrupt_to_root(interrupt: Interrupt) -> &'static InterruptRoot {
///
/// # Safety
/// * You *must not* allocate in an interrupt.
/// - Many functions in agb allocate and it isn't always clear.
///
/// # Staticness
/// * The closure must be static because forgetting the interrupt handler will
@ -240,12 +241,14 @@ fn interrupt_to_root(interrupt: Interrupt) -> &'static InterruptRoot {
/// ```rust,no_run
/// # #![no_std]
/// # #![no_main]
/// use bare_metal::CriticalSection;
///
/// # fn foo() {
/// # use agb::interrupt::{add_interrupt_handler, Interrupt};
/// let _a = add_interrupt_handler(Interrupt::VBlank, |_: CriticalSection| {
/// agb::println!("Woah there! There's been a vblank!");
/// use bare_metal::CriticalSection;
/// use agb::interrupt::{add_interrupt_handler, Interrupt};
/// // Safety: doesn't allocate
/// let _a = unsafe {
/// add_interrupt_handler(Interrupt::VBlank, |_: CriticalSection| {
/// agb::println!("Woah there! There's been a vblank!");
/// }
/// });
/// # }
/// ```