Enum exr::image::crop::CropResult
source · pub enum CropResult<Cropped, Old> {
Cropped(Cropped),
Empty {
original: Old,
},
}
Expand description
Cropping an image fails if the image is fully transparent.
Use [or_crop_to_1x1_if_empty
] or [or_none_if_empty
] to obtain a normal image again.
Variants§
Cropped(Cropped)
The image contained some pixels and has been cropped or left untouched
Empty
All pixels in the image would be discarded, removing the whole image
Fields
§
original: Old
The fully discarded image which caused the cropping to fail
Implementations§
source§impl<Cropped, Original> CropResult<Cropped, Original>
impl<Cropped, Original> CropResult<Cropped, Original>
sourcepub fn or_none_if_empty(self) -> Option<Cropped>
pub fn or_none_if_empty(self) -> Option<Cropped>
If the image was fully empty, return None
, otherwise return Some(cropped_image)
.
sourcepub fn or_crop_to_1x1_if_empty(self) -> Cropped
pub fn or_crop_to_1x1_if_empty(self) -> Cropped
If the image was fully empty, crop to one single pixel of all the transparent pixels instead, leaving the layer intact while reducing memory usage.
Trait Implementations§
source§impl<Cropped: Clone, Old: Clone> Clone for CropResult<Cropped, Old>
impl<Cropped: Clone, Old: Clone> Clone for CropResult<Cropped, Old>
source§fn clone(&self) -> CropResult<Cropped, Old>
fn clone(&self) -> CropResult<Cropped, Old>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<Cropped: PartialEq, Old: PartialEq> PartialEq for CropResult<Cropped, Old>
impl<Cropped: PartialEq, Old: PartialEq> PartialEq for CropResult<Cropped, Old>
source§fn eq(&self, other: &CropResult<Cropped, Old>) -> bool
fn eq(&self, other: &CropResult<Cropped, Old>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl<Cropped: Copy, Old: Copy> Copy for CropResult<Cropped, Old>
impl<Cropped: Eq, Old: Eq> Eq for CropResult<Cropped, Old>
impl<Cropped, Old> StructuralPartialEq for CropResult<Cropped, Old>
Auto Trait Implementations§
impl<Cropped, Old> Freeze for CropResult<Cropped, Old>
impl<Cropped, Old> RefUnwindSafe for CropResult<Cropped, Old>where
Cropped: RefUnwindSafe,
Old: RefUnwindSafe,
impl<Cropped, Old> Send for CropResult<Cropped, Old>
impl<Cropped, Old> Sync for CropResult<Cropped, Old>
impl<Cropped, Old> Unpin for CropResult<Cropped, Old>
impl<Cropped, Old> UnwindSafe for CropResult<Cropped, Old>where
Cropped: UnwindSafe,
Old: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more