mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 16:21:33 +11:00
fix doc example
This commit is contained in:
parent
96a321504c
commit
686ded4377
|
@ -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| {
|
||||
/// 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!");
|
||||
/// }
|
||||
/// });
|
||||
/// # }
|
||||
/// ```
|
||||
|
|
Loading…
Reference in a new issue