pub struct ImageLimitSettings {
pub max_dimension: u32,
pub max_pixels: u64,
pub dimensions_cache_ttl_secs: u64,
}Expand description
图片处理尺寸限制与尺寸缓存配置。
需重启生效层:值在进程启动时烘焙进 LazyLock,改 DB 值后需重启才生效。
Fields§
§max_dimension: u32图片单边(宽或高)尺寸上限(像素)。
max_pixels: u64允许处理的最大图片像素数。⚠️ 此值同时决定单图解码内存缓冲 (max_alloc = pixels × 4 + 1MB),默认 50M 像素对应约 200MB/图。
dimensions_cache_ttl_secs: u64图片尺寸缓存 TTL(秒)。
Implementations§
Source§impl ImageLimitSettings
impl ImageLimitSettings
Sourcepub fn clamp_max_dimension(n: u32) -> u32
pub fn clamp_max_dimension(n: u32) -> u32
将单边尺寸钳制到合法范围 [MIN, ∞)。
Sourcepub fn clamp_max_pixels(n: u64) -> u64
pub fn clamp_max_pixels(n: u64) -> u64
将像素总数钳制到合法范围 [MIN, ∞)。
Sourcepub fn clamp_dimensions_cache_ttl_secs(n: u64) -> u64
pub fn clamp_dimensions_cache_ttl_secs(n: u64) -> u64
将尺寸缓存 TTL 钳制到合法范围 [MIN, ∞)。
Trait Implementations§
Source§impl Clone for ImageLimitSettings
impl Clone for ImageLimitSettings
Source§fn clone(&self) -> ImageLimitSettings
fn clone(&self) -> ImageLimitSettings
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 ImageLimitSettings
impl Debug for ImageLimitSettings
Source§impl Default for ImageLimitSettings
impl Default for ImageLimitSettings
Source§impl<'de> Deserialize<'de> for ImageLimitSettings
impl<'de> Deserialize<'de> for ImageLimitSettings
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 ImageLimitSettings
impl PartialEq for ImageLimitSettings
Source§impl Serialize for ImageLimitSettings
impl Serialize for ImageLimitSettings
impl StructuralPartialEq for ImageLimitSettings
Auto Trait Implementations§
impl Freeze for ImageLimitSettings
impl RefUnwindSafe for ImageLimitSettings
impl Send for ImageLimitSettings
impl Sync for ImageLimitSettings
impl Unpin for ImageLimitSettings
impl UnsafeUnpin for ImageLimitSettings
impl UnwindSafe for ImageLimitSettings
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