pub struct PreviewOptions { /* private fields */ }Expand description
Parameters for generating a thumbnail or preview image.
Corresponds to the query parameters accepted by Nextcloud’s preview endpoint:
x: Width in pixelsy: Height in pixelsa: Whether to keep aspect ratio (1or0)mode: Scaling mode ("cover"or"fill")
Implementations§
Source§impl PreviewOptions
impl PreviewOptions
Sourcepub const fn width(self, width: u32) -> Self
pub const fn width(self, width: u32) -> Self
Sets the desired preview width in pixels (x parameter).
Sourcepub const fn height(self, height: u32) -> Self
pub const fn height(self, height: u32) -> Self
Sets the desired preview height in pixels (y parameter).
Sourcepub const fn dimensions(self, width: u32, height: u32) -> Self
pub const fn dimensions(self, width: u32, height: u32) -> Self
Sets both width and height in pixels (x and y parameters).
Sourcepub const fn keep_aspect_ratio(self, keep: bool) -> Self
pub const fn keep_aspect_ratio(self, keep: bool) -> Self
Specifies whether to keep the image aspect ratio (a parameter).
When true, Nextcloud preserves the aspect ratio (a=1).
When false, Nextcloud crops or distorts (a=0).
Sourcepub const fn mode(self, mode: PreviewMode) -> Self
pub const fn mode(self, mode: PreviewMode) -> Self
Sets the scaling mode (mode parameter).
Sourcepub const fn height_px(&self) -> Option<u32>
pub const fn height_px(&self) -> Option<u32>
The desired preview height in pixels, if specified.
Sourcepub const fn aspect_ratio(&self) -> Option<bool>
pub const fn aspect_ratio(&self) -> Option<bool>
Whether aspect ratio should be preserved, if specified.
Sourcepub const fn preview_mode(&self) -> Option<PreviewMode>
pub const fn preview_mode(&self) -> Option<PreviewMode>
The scaling mode, if specified.
Trait Implementations§
Source§impl Clone for PreviewOptions
impl Clone for PreviewOptions
impl Copy for PreviewOptions
Source§impl Debug for PreviewOptions
impl Debug for PreviewOptions
Source§impl Default for PreviewOptions
impl Default for PreviewOptions
impl Eq for PreviewOptions
Source§impl PartialEq for PreviewOptions
impl PartialEq for PreviewOptions
impl StructuralPartialEq for PreviewOptions
Auto Trait Implementations§
impl Freeze for PreviewOptions
impl RefUnwindSafe for PreviewOptions
impl Send for PreviewOptions
impl Sync for PreviewOptions
impl Unpin for PreviewOptions
impl UnsafeUnpin for PreviewOptions
impl UnwindSafe for PreviewOptions
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