#[repr(u8)]pub enum ObjectFit {
Fill = 0,
Contain = 1,
Cover = 2,
ScaleDown = 3,
None = 4,
}Expand description
图像内容在目标盒子中的缩放适配模式(对应 CSS object-fit)。
Variants§
Fill = 0
拉伸填满整个目标区域(不保持纵横比)。
Contain = 1
等比缩放使整张图完整显示在盒子内(可能留边)。
Cover = 2
等比缩放填满整个盒子并裁切溢出边缘(最常用于头像/卡片封面)。
ScaleDown = 3
仅当原图大于目标盒子时等比缩小,否则按原尺寸居中显示。
None = 4
按原尺寸居中显示,不做缩放。
Trait Implementations§
impl Copy for ObjectFit
impl Eq for ObjectFit
impl StructuralPartialEq for ObjectFit
Auto Trait Implementations§
impl Forget for ObjectFit
impl Freeze for ObjectFit
impl Move for ObjectFit
impl RefUnwindSafe for ObjectFit
impl Send for ObjectFit
impl Sync for ObjectFit
impl Unpin for ObjectFit
impl UnsafeUnpin for ObjectFit
impl UnwindSafe for ObjectFit
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> FluentBuilder for T
impl<T> FluentBuilder for T
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
当
condition 为 true 时执行闭包修饰自身,否则原样返回。Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Self
fn when_else( self, condition: bool, then: impl FnOnce(Self) -> Self, else_fn: impl FnOnce(Self) -> Self, ) -> Self
根据
condition 在两个修饰分支之间二选一。Source§fn when_some<O>(
self,
option: Option<O>,
then: impl FnOnce(Self, O) -> Self,
) -> Self
fn when_some<O>( self, option: Option<O>, then: impl FnOnce(Self, O) -> Self, ) -> Self
当
option 为 Some(value) 时执行闭包修饰自身,否则原样返回。