pub enum Fit {
ScaleDown,
Contain,
Cover,
Crop,
Pad,
}Expand description
How a Variant fits the image in its width × height box (Cloudflare’s fit option).
§Examples
use ocre::storage::{Fit, Variant};
let thumb = Variant::new().width(200).height(200).fit(Fit::Cover);
assert_eq!(thumb.path("/photos/1/image"), "/cdn-cgi/image/width=200,height=200,fit=cover,format=auto/photos/1/image");Variants§
ScaleDown
Like Contain, but never enlarges a smaller image (Active Storage’s resize_to_limit).
Contain
Fits inside the box, keeping the aspect ratio (resize_to_fit).
Cover
Fills the box, cropping what overflows (resize_to_fill).
Crop
Like Cover, but never enlarges a smaller image.
Pad
Like Contain, then pads to the exact box size (resize_and_pad).
Trait Implementations§
impl Copy for Fit
impl Eq for Fit
impl StructuralPartialEq for Fit
Auto Trait Implementations§
impl Freeze for Fit
impl RefUnwindSafe for Fit
impl Send for Fit
impl Sync for Fit
impl Unpin for Fit
impl UnsafeUnpin for Fit
impl UnwindSafe for Fit
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.