[−][src]Trait exr::io::Data
Generic trait that defines common binary operations such as reading and writing for this type.
Associated Constants
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.
Provided methods
fn read_vec(
read: &mut impl Read,
data_size: usize,
soft_max: usize,
hard_max: Option<usize>
) -> Result<Vec<Self>>
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: &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: &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: &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.