pub enum ObjectFit {
Fill,
Contain,
Cover,
ScaleDown,
None,
}Expand description
Defines how an image should be resized to fit its container.
Similar to CSS object-fit property.
Variants§
Fill
The replaced content is sized to fill the element’s content box exactly, without maintaining aspect ratio
Contain
The replaced content is scaled to maintain its aspect ratio while fitting within the element’s content box
Cover
The replaced content is sized to maintain its aspect ratio while filling the element’s entire content box
ScaleDown
The content is sized as if none or contain were specified, whichever would result in a smaller concrete object size
None
The replaced content is not resized and maintains its intrinsic dimensions
Trait Implementations§
impl Copy for ObjectFit
Source§impl<'i> FromCss<'i> for ObjectFit
impl<'i> FromCss<'i> for ObjectFit
Source§const VALID_TOKENS: &'static [CssToken]
const VALID_TOKENS: &'static [CssToken]
Returns the list of valid CSS tokens for this type.
Source§fn from_css(input: &mut Parser<'i, '_>) -> ParseResult<'i, Self>
fn from_css(input: &mut Parser<'i, '_>) -> ParseResult<'i, Self>
Parses the type from a
Parser instance.Source§fn from_str(source: &'i str) -> ParseResult<'i, Self>where
Self: Sized,
fn from_str(source: &'i str) -> ParseResult<'i, Self>where
Self: Sized,
Helper function to parse the type from a string.
Source§const EXPECT_MESSAGE: CssExpectedMessage = CssExpectedMessage::OneValue
const EXPECT_MESSAGE: CssExpectedMessage = CssExpectedMessage::OneValue
Message template used when building parse errors for this type.
impl StructuralPartialEq for ObjectFit
Source§impl TailwindPropertyParser for ObjectFit
impl TailwindPropertyParser 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 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