From 941eb4ade10918bbea0336072ca91488ef2fccf8 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Wed, 28 Feb 2024 09:55:55 +0000 Subject: [PATCH] Add missing default implementations --- agb/src/rng.rs | 6 ++++++ agb/src/sync/locks.rs | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/agb/src/rng.rs b/agb/src/rng.rs index f0ef404f..b98ad6ce 100644 --- a/agb/src/rng.rs +++ b/agb/src/rng.rs @@ -52,6 +52,12 @@ impl RandomNumberGenerator { } } +impl Default for RandomNumberGenerator { + fn default() -> Self { + Self::new() + } +} + static GLOBAL_RNG: Mutex> = Mutex::new(RefCell::new(RandomNumberGenerator::new())); diff --git a/agb/src/sync/locks.rs b/agb/src/sync/locks.rs index fdb7033f..18155522 100644 --- a/agb/src/sync/locks.rs +++ b/agb/src/sync/locks.rs @@ -60,6 +60,12 @@ impl RawMutex { unsafe impl Send for RawMutex {} unsafe impl Sync for RawMutex {} +impl Default for RawMutex { + fn default() -> Self { + Self::new() + } +} + /// A guard representing an active lock on an [`RawMutex`]. pub struct RawMutexGuard<'a>(&'a RawMutex); impl<'a> Drop for RawMutexGuard<'a> {