From 9bddbdba1cde5e1d3c3c6f9a71b5f21a2479e450 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper Date: Sat, 8 Oct 2022 22:40:20 +0100 Subject: [PATCH] Seal the TiledMap trait --- agb/src/display/tiled/map.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/agb/src/display/tiled/map.rs b/agb/src/display/tiled/map.rs index c094e966..bfe3399e 100644 --- a/agb/src/display/tiled/map.rs +++ b/agb/src/display/tiled/map.rs @@ -15,7 +15,7 @@ use super::{ use crate::syscall::BgAffineSetData; use alloc::{vec, vec::Vec}; -pub trait TiledMapTypes { +pub trait TiledMapTypes: private::Sealed { type Size: BackgroundSize + Copy; } @@ -44,6 +44,8 @@ trait TiledMapPrivate: TiledMapTypes { } } +/// Trait which describes methods available on both tiled maps and affine maps. Note that +/// it is 'sealed' so you cannot implement this yourself. pub trait TiledMap: TiledMapTypes { fn clear(&mut self, vram: &mut VRamManager); fn show(&mut self); @@ -429,3 +431,10 @@ impl<'a, T> Drop for MapLoan<'a, T> { } } } + +mod private { + pub trait Sealed {} + + impl Sealed for super::RegularMap {} + impl Sealed for super::AffineMap {} +}