mirror of
https://github.com/bspeice/kaitai_rust
synced 2024-11-22 05:48:12 -05:00
Explicit lifetime for self
Because we give a reference to ourselves out to children as `_parent`, we can't use an anonymous lifetime
This commit is contained in:
parent
1cec9a0fe6
commit
442b5c4006
@ -22,11 +22,13 @@ pub trait KStruct<'a> {
|
||||
|
||||
/// Create a new instance of this struct; if we are the root node,
|
||||
/// then both `_parent` and `_root` will be `None`.
|
||||
// `_root` is an Option because we need to create a root in the first place
|
||||
fn new(_parent: Option<&'a Self::Parent>, _root: Option<&'a Self::Root>) -> KResult<'a, Self>
|
||||
where
|
||||
Self: Sized;
|
||||
|
||||
fn read<S: KStream>(&mut self, stream: &mut S) -> KResult<'a, ()>;
|
||||
/// Parse this struct (and any children) from the supplied stream
|
||||
fn read<S: KStream>(&'a mut self, stream: &mut S) -> KResult<'a, ()>;
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Copy, Clone)]
|
||||
|
Loading…
Reference in New Issue
Block a user