Trait BinaryEntry

Source
pub trait BinaryEntry: Sized {
    // Required methods
    fn entry_write(data_in: Self, buffer_out: &mut Vec<u8>) -> Result<()>;
    fn entry_read(file: &mut File) -> Result<Self>;
    fn entry_size() -> i64;
}
Expand description

A single entry to be written to a binary file.

Required Methods§

Source

fn entry_write(data_in: Self, buffer_out: &mut Vec<u8>) -> Result<()>

Write an entry to a reusable output buffer.

Source

fn entry_read(file: &mut File) -> Result<Self>

Read an entry from a file.

Source

fn entry_size() -> i64

Get the size of an entry.

Entries can vary in complexity, so it’s necessary to implement this rather than magically calculate it.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl BinaryEntry for f32

Source§

fn entry_write(data_in: Self, buffer_out: &mut Vec<u8>) -> Result<()>

Source§

fn entry_read(file: &mut File) -> Result<Self>

Source§

fn entry_size() -> i64

Source§

impl BinaryEntry for i64

Source§

fn entry_write(data_in: Self, buffer_out: &mut Vec<u8>) -> Result<()>

Source§

fn entry_read(file: &mut File) -> Result<Self>

Source§

fn entry_size() -> i64

Implementors§