[][src]Trait exr::io::Data

pub trait Data: Sized + Default + Clone {
    const BYTE_SIZE: usize;

    fn read(read: &mut impl Read) -> Result<Self>;
fn read_slice(read: &mut impl Read, slice: &mut [Self]) -> PassiveResult;
fn write(self, write: &mut impl Write) -> PassiveResult;
fn write_slice(write: &mut impl Write, slice: &[Self]) -> PassiveResult; fn read_vec(
        read: &mut impl Read,
        data_size: usize,
        soft_max: usize,
        hard_max: Option<usize>
    ) -> Result<Vec<Self>> { ... }
fn read_into_vec(
        read: &mut impl Read,
        data: &mut Vec<Self>,
        data_size: usize,
        soft_max: usize,
        hard_max: Option<usize>
    ) -> PassiveResult { ... }
fn write_i32_sized_slice<W: Write>(
        write: &mut W,
        slice: &[Self]
    ) -> PassiveResult { ... }
fn read_i32_sized_vec(
        read: &mut impl Read,
        soft_max: usize,
        hard_max: Option<usize>
    ) -> Result<Vec<Self>> { ... } }

Generic trait that defines common binary operations such as reading and writing for this type.

Associated Constants

const BYTE_SIZE: usize

Number of bytes this would consume in an exr file.

Loading content...

Required methods

fn read(read: &mut impl Read) -> Result<Self>

Read a value of type Self.

fn read_slice(read: &mut impl Read, slice: &mut [Self]) -> PassiveResult

Read as many values of type Self as fit into the specified slice. If the slice cannot be filled completely, returns Error::Invalid.

fn write(self, write: &mut impl Write) -> PassiveResult

Write this value to the writer.

fn write_slice(write: &mut impl Write, slice: &[Self]) -> PassiveResult

Write all values of that slice to the writer.

Loading content...

Provided methods

fn read_vec(
    read: &mut impl Read,
    data_size: usize,
    soft_max: usize,
    hard_max: Option<usize>
) -> Result<Vec<Self>>

Read as many values of type Self as specified with data_size.

This method will not allocate more memory than soft_max at once. If hard_max is specified, it will never read any more than that. Returns Error::Invalid if reader does not contain the desired number of elements.

fn read_into_vec(
    read: &mut impl Read,
    data: &mut Vec<Self>,
    data_size: usize,
    soft_max: usize,
    hard_max: Option<usize>
) -> PassiveResult

Read as many values of type Self as specified with data_size into the provided vector.

This method will not allocate more memory than soft_max at once. If hard_max is specified, it will never read any more than that. Returns Error::Invalid if reader does not contain the desired number of elements.

fn write_i32_sized_slice<W: Write>(
    write: &mut W,
    slice: &[Self]
) -> PassiveResult

Write the length of the slice and then its contents.

fn read_i32_sized_vec(
    read: &mut impl Read,
    soft_max: usize,
    hard_max: Option<usize>
) -> Result<Vec<Self>>

Read the desired element count and then read that many items into a vector.

This method will not allocate more memory than soft_max at once. If hard_max is specified, it will never read any more than that. Returns Error::Invalid if reader does not contain the desired number of elements.

Loading content...

Implementations on Foreign Types

impl Data for u8[src]

impl Data for i8[src]

impl Data for i16[src]

impl Data for u16[src]

impl Data for u32[src]

impl Data for i32[src]

impl Data for i64[src]

impl Data for u64[src]

impl Data for f32[src]

impl Data for f64[src]

Loading content...

Implementors

impl Data for f16[src]

Loading content...