mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-24 00:31:34 +11:00
Add lifetimes to timers
This commit is contained in:
parent
2bab48b422
commit
92066f7adb
|
@ -375,6 +375,7 @@ mod marker {
|
||||||
/// Allows access to the cartridge's save data.
|
/// Allows access to the cartridge's save data.
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub struct SaveManager {}
|
pub struct SaveManager {}
|
||||||
|
|
||||||
impl SaveManager {
|
impl SaveManager {
|
||||||
pub(crate) const fn new() -> Self {
|
pub(crate) const fn new() -> Self {
|
||||||
SaveManager {}
|
SaveManager {}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
use core::marker::PhantomData;
|
||||||
|
|
||||||
use crate::memory_mapped::MemoryMapped;
|
use crate::memory_mapped::MemoryMapped;
|
||||||
|
|
||||||
const fn timer_data(timer: usize) -> MemoryMapped<u16> {
|
const fn timer_data(timer: usize) -> MemoryMapped<u16> {
|
||||||
|
@ -39,16 +41,20 @@ pub struct Timer {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub struct Timers {
|
pub struct Timers<'gba> {
|
||||||
pub timer2: Timer,
|
pub timer2: Timer,
|
||||||
pub timer3: Timer,
|
pub timer3: Timer,
|
||||||
|
|
||||||
|
phantom: PhantomData<&'gba ()>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Timers {
|
impl Timers<'_> {
|
||||||
pub(crate) unsafe fn new() -> Self {
|
pub(crate) unsafe fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
timer2: Timer::new(2),
|
timer2: Timer::new(2),
|
||||||
timer3: Timer::new(3),
|
timer3: Timer::new(3),
|
||||||
|
|
||||||
|
phantom: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,7 +135,7 @@ impl TimerController {
|
||||||
Self {}
|
Self {}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn timers(&mut self) -> Timers {
|
pub fn timers(&mut self) -> Timers<'_> {
|
||||||
unsafe { Timers::new() }
|
unsafe { Timers::new() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue