pub enum ObjectFit {
Fill,
None,
Contain,
Cover,
}Expand description
Defines the method for fitting objects that do not match the dimensions of their container.
Variants§
Fill
Fills the container without respecting the aspect ratio of the object if the dimensions of the container isn’t a multiple of the dimensions of the object.
None
Applies no scaling to the object.
Contain
Scales the object so that it is completely visible while maintaining its aspect ratio. If after scaling, one of the dimensions is smaller than the corresponding dimension of the container, the object is centered within its container.
Cover
Scales the object so that it completely covers its container, while maintaining its aspect ratio. If after scaling, one of the dimensions is larger than the corresponding dimension of the container, the object is centered within its container and the invisible area is split evenly across both ends of the relevant dimension.
Trait Implementations§
impl Copy for ObjectFit
impl Eq for ObjectFit
impl StructuralPartialEq for ObjectFit
Auto Trait Implementations§
impl Freeze for ObjectFit
impl RefUnwindSafe for ObjectFit
impl Send for ObjectFit
impl Sync for ObjectFit
impl Unpin for ObjectFit
impl UnwindSafe for ObjectFit
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
Source§fn convert_into(self) -> U
fn convert_into(self) -> U
Source§fn convert_unclamped_into(self) -> U
fn convert_unclamped_into(self) -> U
Source§fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
OutOfBounds error is returned which contains the unclamped color. Read more