pub struct Section<'tape, 'data> {
tape: &'tape mut Tape<'data>,
name: String,
}
Expand description
A section of the save file. It directly maps to a SaveFileObject and is the largest unit of data in the save file. Since Tape holds state, it must be mutable for the section to be parsable.
Fields§
§tape: &'tape mut Tape<'data>
§name: String
Implementations§
Source§impl<'tape, 'data> Section<'tape, 'data>
impl<'tape, 'data> Section<'tape, 'data>
Sourcepub fn new(tape: &'tape mut Tape<'data>, name: String) -> Self
pub fn new(tape: &'tape mut Tape<'data>, name: String) -> Self
Create a new section from a tape.
The section will be named name
and will start at offset
and end at end
.
The first token of the section (pointed at by offset
) is expected to an object or array token.
The end token is not included in the section.
Sourcepub fn skip(&mut self) -> Result<(), SectionError>
pub fn skip(&mut self) -> Result<(), SectionError>
Skip the section. This must be called if the section is not going to be parsed.
Sourcepub fn parse(&mut self) -> Result<SaveFileObject, SectionError>
pub fn parse(&mut self) -> Result<SaveFileObject, SectionError>
Parse the section into a SaveFileObject. This will consume the section.
Trait Implementations§
Auto Trait Implementations§
impl<'tape, 'data> Freeze for Section<'tape, 'data>
impl<'tape, 'data> RefUnwindSafe for Section<'tape, 'data>
impl<'tape, 'data> !Send for Section<'tape, 'data>
impl<'tape, 'data> !Sync for Section<'tape, 'data>
impl<'tape, 'data> Unpin for Section<'tape, 'data>
impl<'tape, 'data> !UnwindSafe for Section<'tape, 'data>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more