From fc1c9e843f66b50d8229a0a1294b977897768565 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Mon, 15 Jan 2024 19:30:26 -0800 Subject: [PATCH] oopsies --- src/file.rs | 24 +----------------------- src/lib.rs | 26 ++++++++++++++++++++------ 2 files changed, 21 insertions(+), 29 deletions(-) diff --git a/src/file.rs b/src/file.rs index d615526..c25d2b2 100644 --- a/src/file.rs +++ b/src/file.rs @@ -1,24 +1,9 @@ //file format "sniff" pub enum Error{ - Header(HeaderError), - Map(crate::map::Error), - Bot(crate::bot::Error), - Demo(crate::demo::Error), -} - -pub enum MissingData{ - NeedExactly(usize),//missing exactly this many bytes - NeedAtLeast(usize),//missing at least this many bytes -} - -pub enum HeaderError{ InvalidMagic, InvalidVersion, - UnexpectedEOF{ - eof:usize, - missing_data:MissingData, - },//file ends in the middle of the header + UnexpectedEOF, } /* spec @@ -53,7 +38,6 @@ pub enum Magic{ Map, //"SNFM" Bot, //"SNFB" Demo, //"SNFD" - PlaylistDemo, } pub struct Header{ @@ -71,9 +55,3 @@ pub struct BlockLayout{ count:u64, location:Vec, } - -pub enum SNF{ - Map(crate::map::Map), - Bot(crate::bot::Bot), - Demo(crate::demo::Demo), -} \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 6312614..01caa08 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,12 +1,26 @@ use std::io::Read; -mod file; -mod map; -mod bot; -mod demo; +pub mod file; +pub mod map; +pub mod bot; +pub mod demo; -pub fn read(input:R)->Result{ - Err(file::Error::Header(file::HeaderError::InvalidMagic)) +pub enum Error{ + Header(file::Error), + Map(map::Error), + Bot(bot::Error), + Demo(demo::Error), +} + +pub enum SNF{ + Map(map::Map), + Bot(bot::Bot), + Demo(demo::Demo), +} + +pub fn read(input:R)->Result{ + //let header:file::Header=input.read()?; + Err(Error::Header(file::Error::InvalidMagic)) } #[cfg(test)]