[][src]Struct ddsavelib::File

pub struct File { /* fields omitted */ }

Represents a valid Darkest Dungeon save file.

See the main library docs for usage examples.

A note on binary file identity

Files produced by the game currently contain unidentified bits. Right now, if you read a binary file and encode it to binary again, you will encounter some different bits. Theoretically, sizes could be different due to data alignment, though this has not been observed in practice yet. Phrased differently, the Binary => File conversion is minimally lossy. File => Binary and File <=> JSON conversions are lossless.

It is recommended that tools operating on the JSON representation preserve the order of fields in the file.

Implementations

impl File[src]

pub fn try_from_bin<R: Read>(reader: &mut R) -> Result<Self, FromBinError>[src]

Attempt create a Darkest Dungeon save File from a Read representing a binary encoded file.

pub fn write_to_bin<W: Write>(&self, writer: &mut W) -> Result<()>[src]

Write this File as Binary.

impl File[src]

pub fn try_from_json<R: Read>(reader: &mut R) -> Result<Self, FromJsonError>[src]

Attempt to decode a File from a Read representing a JSON stream.

pub fn write_to_json<T: AsRef<str>, W: Write>(
    &self,
    writer: &mut W,
    allow_dupes: bool,
    unhash: &Unhasher<T>
) -> Result<()>
[src]

Write this File as JSON.

Trait Implementations

impl Clone for File[src]

impl Debug for File[src]

impl PartialEq<File> for File[src]

impl StructuralPartialEq for File[src]

Auto Trait Implementations

impl RefUnwindSafe for File

impl Send for File

impl Sync for File

impl Unpin for File

impl UnwindSafe for File

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.