diff --git a/elf/src/file.rs b/elf/src/file.rs index 396f7c04..b09ac882 100644 --- a/elf/src/file.rs +++ b/elf/src/file.rs @@ -30,8 +30,8 @@ pub trait Header { type Word: ElfWord; /// Attempt to extract an ELF file header from a slice of bytes. - /// TODO: should this be a From impl maybe? - // - eliza, 03/08/2017 + /// TODO: rewrite this as a `TryFrom` implementation (see issue #85) + // - eliza, 03/09/2017 fn from_slice<'a>(input: &'a [u8]) -> ElfResult<&'a Self>; /// Attempt to extract a section header from a slice of bytes. @@ -80,10 +80,6 @@ pub trait Header { } - -/// FIXME(style): generate more stuff with macros/use `macro_attr` to derive -/// these... -// - eliza, 03/08/2017 macro_rules! impl_getters { ($(#[$attr:meta])* pub fn $name:ident(&self) -> $ty:ident; $($rest:tt)*) => { $(#[$attr])* #[inline] pub fn $name(&self) -> $ty { self.$name as $ty } diff --git a/elf/src/lib.rs b/elf/src/lib.rs index 646bc4c3..df68adef 100644 --- a/elf/src/lib.rs +++ b/elf/src/lib.rs @@ -2,7 +2,7 @@ // SOS: the Stupid Operating System // by Eliza Weisman (hi@hawkweisman.me) // -// Copyright (c) 2015-2016 Eliza Weisman +// Copyright (c) 2015-2017 Eliza Weisman // Released under the terms of the MIT license. See `LICENSE` in the root // directory of this repository for more information. // @@ -35,6 +35,7 @@ pub type Section<'a> = section::Header<'a>; /// An ELF header file. pub type FileHeader = file::HeaderRepr; +/// TODO: should ELF have its own error type? pub type ElfResult = Result; pub trait ElfWord: Sized + Copy + Clone @@ -88,6 +89,8 @@ where Word: ElfWord + 'a /// if `n` == 0, this will give you an `&[]`. just a warning. // thanks to Max for making me figure this out. +/// TODO: rewrite this as a `TryFrom` implementation (see issue #85) +// - eliza, 03/09/2017 unsafe fn extract_from_slice( data: &[u8] , offset: usize , n: usize) diff --git a/elf/src/program.rs b/elf/src/program.rs index ff0deb19..5c751819 100644 --- a/elf/src/program.rs +++ b/elf/src/program.rs @@ -2,7 +2,7 @@ // SOS: the Stupid Operating System // by Eliza Weisman (hi@hawkweisman.me) // -// Copyright (c) 2015-2016 Eliza Weisman +// Copyright (c) 2015-2017 Eliza Weisman // Released under the terms of the MIT license. See `LICENSE` in the root // directory of this repository for more information. // diff --git a/elf/src/section.rs b/elf/src/section.rs index 810c8e7e..cb3554d9 100644 --- a/elf/src/section.rs +++ b/elf/src/section.rs @@ -273,6 +273,8 @@ pub enum Contents<'a> { struct TypeRepr(u32); impl TypeRepr { + /// TODO: rewrite this as a `TryFrom` implementation (see issue #85) + // - eliza, 03/09/2017 #[inline] fn as_type(&self) -> ElfResult { match self.0 { 0 => Ok(Type::Null)