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
|
/// # 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!");
|
||||||
|
/// }
|
||||||
/// });
|
/// });
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
Loading…
Reference in a new issue