#[non_exhaustive]pub struct EncodeOptions {
pub quality: u8,
pub lossless: bool,
}Expand description
Encoder tuning shared across formats.
Fields that a format has no notion of are ignored by that format rather than rejected, so the same options value can be handed to any encoder.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.quality: u8Lossy quality, 1–100. Ignored by lossless formats, and by a format
with both modes when lossless is set.
lossless: boolFor a format that has both a lossy and a lossless mode (WebP), choose
lossless. Off by default: such a format encodes lossy at quality,
as cwebp and sharp do. Formats with one mode ignore it.
Implementations§
Source§impl EncodeOptions
impl EncodeOptions
Sourcepub const DEFAULT_QUALITY: u8 = 80
pub const DEFAULT_QUALITY: u8 = 80
The default quality used when none is given.
Sourcepub fn with_quality(quality: u8) -> Result<Self>
pub fn with_quality(quality: u8) -> Result<Self>
Options with the given quality.
§Errors
Returns PixelsError::InvalidArgument unless quality is in 1..=100.
Sourcepub const fn with_lossless(self, lossless: bool) -> Self
pub const fn with_lossless(self, lossless: bool) -> Self
These options with lossless replaced.
Trait Implementations§
Source§impl Clone for EncodeOptions
impl Clone for EncodeOptions
impl Copy for EncodeOptions
Source§impl Debug for EncodeOptions
impl Debug for EncodeOptions
Source§impl Default for EncodeOptions
impl Default for EncodeOptions
impl Eq for EncodeOptions
Source§impl PartialEq for EncodeOptions
impl PartialEq for EncodeOptions
impl StructuralPartialEq for EncodeOptions
Auto Trait Implementations§
impl Freeze for EncodeOptions
impl RefUnwindSafe for EncodeOptions
impl Send for EncodeOptions
impl Sync for EncodeOptions
impl Unpin for EncodeOptions
impl UnsafeUnpin for EncodeOptions
impl UnwindSafe for EncodeOptions
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