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