Struct ReadImage
pub struct ReadImage<OnProgress, ReadLayers> { /* private fields */ }
Specify whether to read the image in parallel, whether to use pedantic error handling, and a callback for the reading progress.
Implementations
impl<F, L> ReadImage<F, L>
where
F: FnMut(f64),
fn new(read_layers: L, on_progress: F) -> SelfUses relaxed error handling and parallel decompression.
fn pedantic(self) -> SelfSpecify that any missing or unusual information should result in an error. Otherwise,
exrswill try to compute or ignore missing information.If pedantic is true, then an error will be returned as soon as anything is missing in the file, or two values in the image contradict each other. If pedantic is false, then only fatal errors will be thrown. By default, reading an image is not pedantic, which means that slightly invalid files might still be readable. For example, if some attribute is missing but can be recomputed, this flag decides whether an error is thrown. Or if the pedantic flag is true and there are still bytes left after the decompression algorithm finished, an error is thrown, because this should not happen and something might be wrong with the file. Or if your application is a target of attacks, or if you want to emulate the original C++ library, you might want to switch to pedantic reading.
fn non_parallel(self) -> SelfSpecify that multiple pixel blocks should never be decompressed using multiple threads at once. This might be slower but uses less memory and less synchronization.
fn on_progress<OnProgress>(self, on_progress: OnProgress) -> ReadImage<OnProgress, L> where OnProgress: FnMut(f64),Specify a function to be called regularly throughout the loading process. Replaces all previously specified progress functions in this reader.
fn from_file<Layers>(self, path: impl AsRef<Path>) -> Result<Image<Layers>> where for<'s> L: ReadLayers<'s, Layers = Layers>,Read the exr image from a file. Use
ReadImage::read_from_unbufferedinstead, if you do not have a file.fn from_unbuffered<Layers>(self, unbuffered: impl Read + Seek) -> Result<Image<Layers>> where for<'s> L: ReadLayers<'s, Layers = Layers>,Buffer the reader and then read the exr image from it. Use
ReadImage::read_from_bufferedinstead, if your reader is an in-memory reader. UseReadImage::read_from_fileinstead, if you have a file path.fn from_buffered<Layers>(self, buffered: impl Read + Seek) -> Result<Image<Layers>> where for<'s> L: ReadLayers<'s, Layers = Layers>,Read the exr image from a buffered reader. Use
ReadImage::read_from_fileinstead, if you have a file path. UseReadImage::read_from_unbufferedinstead, if this is not an in-memory reader.fn from_chunks<Layers>(self, chunks_reader: Reader<impl Read + Seek>) -> Result<Image<Layers>> where for<'s> L: ReadLayers<'s, Layers = Layers>,Read the exr image from an initialized chunks reader that has already extracted the meta data from the file. Use
ReadImage::read_from_fileinstead, if you have a file path. UseReadImage::read_from_bufferedinstead, if this is an in-memory reader.
Trait Implementations
impl<OnProgress: Clone, ReadLayers: Clone> Clone for ReadImage<OnProgress, ReadLayers>
fn clone(&self) -> Self
impl<OnProgress: Debug, ReadLayers: Debug> Debug for ReadImage<OnProgress, ReadLayers>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Auto Trait Implementations
impl<OnProgress, ReadLayers> Freeze for ReadImage<OnProgress, ReadLayers>
where
OnProgress: Freeze,
ReadLayers: Freeze,
impl<OnProgress, ReadLayers> RefUnwindSafe for ReadImage<OnProgress, ReadLayers>
where
OnProgress: RefUnwindSafe,
ReadLayers: RefUnwindSafe,
impl<OnProgress, ReadLayers> Send for ReadImage<OnProgress, ReadLayers>
where
OnProgress: Send,
ReadLayers: Send,
impl<OnProgress, ReadLayers> Sync for ReadImage<OnProgress, ReadLayers>
where
OnProgress: Sync,
ReadLayers: Sync,
impl<OnProgress, ReadLayers> Unpin for ReadImage<OnProgress, ReadLayers>
where
OnProgress: Unpin,
ReadLayers: Unpin,
impl<OnProgress, ReadLayers> UnsafeUnpin for ReadImage<OnProgress, ReadLayers>
where
OnProgress: UnsafeUnpin,
ReadLayers: UnsafeUnpin,
impl<OnProgress, ReadLayers> UnwindSafe for ReadImage<OnProgress, ReadLayers>
where
OnProgress: UnwindSafe,
ReadLayers: UnwindSafe,
Blanket Implementations
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for ReadImage<OnProgress, ReadLayers>
where
ST: ?Sized,
DT: ?Sized,
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for ReadImage<OnProgress, ReadLayers>
where
ST: ?Sized,
DT: ?Sized,
impl<T> Any for ReadImage<OnProgress, ReadLayers>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for ReadImage<OnProgress, ReadLayers>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for ReadImage<OnProgress, ReadLayers>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for ReadImage<OnProgress, ReadLayers>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for ReadImage<OnProgress, ReadLayers>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Pointable for ReadImage<OnProgress, ReadLayers>
const ALIGN: usize = _;type Init = T;unsafe fn init(init: <T as Pointable>::Init) -> usizeunsafe fn deref<'a>(ptr: usize) -> &'a Tunsafe fn deref_mut<'a>(ptr: usize) -> &'a mut Tunsafe fn drop(ptr: usize)
impl<T> Read<Exclusive, BecauseExclusive> for ReadImage<OnProgress, ReadLayers>
where
T: ?Sized,
impl<T> ToOwned for ReadImage<OnProgress, ReadLayers>
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for ReadImage<OnProgress, ReadLayers>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for ReadImage<OnProgress, ReadLayers>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for ReadImage<OnProgress, ReadLayers>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>