pub enum Sizing {
Shrink,
Fit,
Scale(f64),
}Expand description
Image sizing.
The default is Fit.
Variants§
Shrink
Shrinks the image if it’s too big.
Fit
Shrinks the image if it’s too big or expands it if it’s too small.
Scale(f64)
Scale.
Implementations§
Source§impl Sizing
impl Sizing
Sourcepub fn original() -> Self
pub fn original() -> Self
Keep the original size: Scale(1.).
Examples found in repository?
examples/scrollable.rs (line 25)
12fn main() {
13 let mut cursive = default();
14
15 cursive.add_layer(
16 Panel::new(
17 ImageView::default()
18 .with_image(
19 // This will decode the JPEG file on-demand
20 // Note that RGBA is supported, too, if you need transparency
21 Image::new_stream_from_jpeg_file(FILE, ImageFormat::RGB).expect("new_stream_from_jpeg_file"),
22 // If you prefer to keep the image data in memory:
23 // Image::new_owned_from_jpeg_file(FILE, ImageFormat::RGB, true).expect("new_owned_from_jpeg_file"),
24 )
25 .with_sizing(Sizing::original())
26 .scrollable()
27 .scroll_x(true),
28 )
29 .fixed_size((50, 20)),
30 );
31
32 cursive.add_global_callback('q', |cursive| cursive.quit());
33
34 cursive.run();
35}Trait Implementations§
impl Copy for Sizing
impl StructuralPartialEq for Sizing
Auto Trait Implementations§
impl Freeze for Sizing
impl RefUnwindSafe for Sizing
impl Send for Sizing
impl Sync for Sizing
impl Unpin for Sizing
impl UnsafeUnpin for Sizing
impl UnwindSafe for Sizing
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