Struct brickadia::read::SaveReader

source ·
pub struct SaveReader<R: Read> {
    pub version: u16,
    pub game_version: i32,
    /* private fields */
}
Expand description

A save reader, which reads data from its reader (a Read + Seek).

Fields§

§version: u16§game_version: i32

Implementations§

source§

impl<R: Read> SaveReader<R>

source

pub fn new(reader: R) -> Result<Self, ReadError>

Create a new save reader from an existing reader, a Read + Seek.

source

pub fn skip_header1(&mut self) -> Result<(), ReadError>

Skip the first header.

source

pub fn read_header1(&mut self) -> Result<Header1, ReadError>

Read the first header.

source

pub fn skip_header2(&mut self) -> Result<(), ReadError>

Skip the second header.

source

pub fn read_header2(&mut self) -> Result<Header2, ReadError>

Read the second header.

source

pub fn read_preview(&mut self) -> Result<Preview, ReadError>

Read the preview in the save.

The preview is an Preview, which might not exist (Preview::None).

source

pub fn skip_preview(&mut self) -> Result<(), ReadError>

Skip over the preview section.

source

pub fn read_bricks( &mut self, header1: &Header1, header2: &Header2 ) -> Result<(Vec<Brick>, HashMap<String, Component>), ReadError>

Read the bricks and components from a save.

source

pub fn read_all(&mut self) -> Result<SaveData, ReadError>

Read all parts of a save into a SaveData.

source

pub fn read_all_skip_preview(&mut self) -> Result<SaveData, ReadError>

Read all parts of a save (except the preview) into a SaveData.

Auto Trait Implementations§

§

impl<R> RefUnwindSafe for SaveReader<R>
where R: RefUnwindSafe,

§

impl<R> Send for SaveReader<R>
where R: Send,

§

impl<R> Sync for SaveReader<R>
where R: Sync,

§

impl<R> Unpin for SaveReader<R>
where R: Unpin,

§

impl<R> UnwindSafe for SaveReader<R>
where R: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.