Skip to main content

SaveFileHeader

Trait SaveFileHeader 

Source
pub trait SaveFileHeader {
    const VERSION: u32;
    const USER_FILE_INFO_MAX: u32;
    const FILE_SIZE_MAX: u32;

    // Required methods
    fn checksum(&self) -> Checksum;
    fn version(&self) -> u32;
    fn user_file_info_num(&self) -> u32;
    fn file_size(&self) -> u32;

    // Provided methods
    fn check_be(&self, buf: &[u8]) -> Result<(), CheckSaveFileError> { ... }
    fn check_le(&self, buf: &[u8]) -> Result<(), CheckSaveFileError> { ... }
    fn check(&self, buf: &[u8]) -> Result<(), CheckSaveFileError> { ... }
}
Expand description

A trait for standardizing save file header implementation.

Required Associated Constants§

Source

const VERSION: u32

The expected version number of the save data.

Source

const USER_FILE_INFO_MAX: u32

The maximum allowed number of user file descriptors.

Source

const FILE_SIZE_MAX: u32

The maximum allowed size of the file, in bytes.

Required Methods§

Source

fn checksum(&self) -> Checksum

Returns the precomputed checksum derived from the file data.

Source

fn version(&self) -> u32

Returns the version number of the save data.

Source

fn user_file_info_num(&self) -> u32

Returns the number of stored user file descriptors.

Source

fn file_size(&self) -> u32

Returns the size of the file, in bytes.

Provided Methods§

Source

fn check_be(&self, buf: &[u8]) -> Result<(), CheckSaveFileError>

Validates the save file header in big-endian.

Source

fn check_le(&self, buf: &[u8]) -> Result<(), CheckSaveFileError>

Validates the save file header in little-endian.

Source

fn check(&self, buf: &[u8]) -> Result<(), CheckSaveFileError>

Validates the save file header without validating the precomputed checksum.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§