mirror of
https://github.com/bspeice/kaitai_rust
synced 2024-11-22 13:58:11 -05:00
Add an UnknownEnum error type, make KaitaiStruct optional for parents
This commit is contained in:
parent
7d297b884a
commit
f9ae7b76cb
@ -4,6 +4,7 @@ use std::io;
|
|||||||
pub enum KaitaiError<'a> {
|
pub enum KaitaiError<'a> {
|
||||||
InvalidContents { actual: &'a [u8] },
|
InvalidContents { actual: &'a [u8] },
|
||||||
IoError(io::Error),
|
IoError(io::Error),
|
||||||
|
UnknownEnum(u64),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> From<io::Error> for KaitaiError<'a> {
|
impl<'a> From<io::Error> for KaitaiError<'a> {
|
||||||
@ -15,7 +16,7 @@ impl<'a> From<io::Error> for KaitaiError<'a> {
|
|||||||
pub type Result<'a, T> = std::result::Result<T, KaitaiError<'a>>;
|
pub type Result<'a, T> = std::result::Result<T, KaitaiError<'a>>;
|
||||||
|
|
||||||
pub trait KaitaiStruct<'a> {
|
pub trait KaitaiStruct<'a> {
|
||||||
type Parent: KaitaiStruct<'a>;
|
type Parent: ?KaitaiStruct<'a>;
|
||||||
type Root: KaitaiStruct<'a>;
|
type Root: KaitaiStruct<'a>;
|
||||||
|
|
||||||
/// Create a new instance of this struct; if we are the root node,
|
/// Create a new instance of this struct; if we are the root node,
|
||||||
|
Loading…
Reference in New Issue
Block a user