pub struct WebpSettings {
pub quality: f32,
pub method: u32,
}Expand description
WebP 有损编码配置(质量与方法)。
需重启生效层:值在进程启动时烘焙进 LazyLock,改 DB 值后需重启才生效。
Fields§
§quality: f32质量系数,范围 0.0–100.0。
method: u32编码方法,范围 0–6,数值越大压缩率越高但越慢。
Implementations§
Source§impl WebpSettings
impl WebpSettings
Sourcepub fn clamp_quality(q: f32) -> f32
pub fn clamp_quality(q: f32) -> f32
将质量钳制到合法范围 [0.0, 100.0]。
Sourcepub fn clamp_method(m: u32) -> u32
pub fn clamp_method(m: u32) -> u32
将编码方法钳制到合法范围 [0, 6]。
Trait Implementations§
Source§impl Clone for WebpSettings
impl Clone for WebpSettings
Source§fn clone(&self) -> WebpSettings
fn clone(&self) -> WebpSettings
Returns a duplicate 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 Debug for WebpSettings
impl Debug for WebpSettings
Source§impl Default for WebpSettings
impl Default for WebpSettings
Source§impl<'de> Deserialize<'de> for WebpSettings
impl<'de> Deserialize<'de> for WebpSettings
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for WebpSettings
impl PartialEq for WebpSettings
Source§impl Serialize for WebpSettings
impl Serialize for WebpSettings
impl StructuralPartialEq for WebpSettings
Auto Trait Implementations§
impl Freeze for WebpSettings
impl RefUnwindSafe for WebpSettings
impl Send for WebpSettings
impl Sync for WebpSettings
impl Unpin for WebpSettings
impl UnsafeUnpin for WebpSettings
impl UnwindSafe for WebpSettings
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Create an instance of this type from an initialization function
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.
§impl<T> Transportable for Twhere
T: Serialize + DeserializeOwned + 'static,
impl<T> Transportable for Twhere
T: Serialize + DeserializeOwned + 'static,
§fn transport_to_bytes(&self) -> Vec<u8> ⓘ
fn transport_to_bytes(&self) -> Vec<u8> ⓘ
Serialize the type to a byte vector for transport
§fn transport_from_bytes(bytes: &[u8]) -> Result<T, Error<Error>>
fn transport_from_bytes(bytes: &[u8]) -> Result<T, Error<Error>>
Deserialize the type from a byte slice