pub struct Transcoder { /* private fields */ }Available on crate feature
multimedia only.Expand description
Transcodes images of any wide-spread types to JPEG thumbnails. Default settings generate previews similar to SimpleX-Chat previews
Implementations§
Source§impl Transcoder
impl Transcoder
pub fn is_enabled(&self) -> bool
Sourcepub fn with_quality(self, quality: u8) -> Self
pub fn with_quality(self, quality: u8) -> Self
Quality is bound between 1..=100 where 1 is the worst
Sourcepub fn transcode_to_jpg(self, bytes: Vec<u8>) -> Result<Vec<u8>, PreviewError>
pub fn transcode_to_jpg(self, bytes: Vec<u8>) -> Result<Vec<u8>, PreviewError>
WARNING: this is a relatively expensive blocking operation, ensure that you call
this method outside the tokio executor with tokio::spawn_blocking or on a dedicated
thread.
Trait Implementations§
Source§impl Clone for Transcoder
impl Clone for Transcoder
Source§fn clone(&self) -> Transcoder
fn clone(&self) -> Transcoder
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Transcoder
impl Debug for Transcoder
Source§impl Default for Transcoder
impl Default for Transcoder
impl Copy for Transcoder
Auto Trait Implementations§
impl Freeze for Transcoder
impl RefUnwindSafe for Transcoder
impl Send for Transcoder
impl Sync for Transcoder
impl Unpin for Transcoder
impl UnsafeUnpin for Transcoder
impl UnwindSafe for Transcoder
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().