Seal the TiledMap trait

This commit is contained in:
Gwilym Kuiper 2022-10-08 22:40:20 +01:00
parent 5c578df227
commit 9bddbdba1c

View file

@ -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 {}
}