make non rust trait parts of vfile private

This commit is contained in:
Corwin 2023-08-08 09:44:29 +01:00
parent ad1f70e6e5
commit d9a0ab1a9f
No known key found for this signature in database

View file

@ -13,7 +13,7 @@ pub enum MapFlag {
Write, Write,
} }
pub trait VFile: Seek + Read + Write { trait VFileExtensions: VFile {
fn readline(&mut self, buffer: &mut [u8]) -> Result<usize> { fn readline(&mut self, buffer: &mut [u8]) -> Result<usize> {
let mut byte = 0; let mut byte = 0;
while byte < buffer.len() - 1 { while byte < buffer.len() - 1 {
@ -92,6 +92,10 @@ pub trait VFile: Seek + Read + Write {
} }
} }
pub trait VFile: Seek + Read + Write {}
impl<T: VFile + ?Sized> VFileExtensions for T {}
#[repr(C)] #[repr(C)]
struct VFileInner<V: VFile> { struct VFileInner<V: VFile> {
vfile: mgba_sys::VFile, vfile: mgba_sys::VFile,
@ -116,6 +120,7 @@ impl<V: VFile> VFileAlloc<V> {
mod vfile_extern { mod vfile_extern {
use std::io::SeekFrom; use std::io::SeekFrom;
use super::VFileExtensions;
/// Safety: Must be part of a VFileInner /// Safety: Must be part of a VFileInner
pub unsafe fn create_vfile<V: super::VFile>() -> mgba_sys::VFile { pub unsafe fn create_vfile<V: super::VFile>() -> mgba_sys::VFile {