pub enum ImageFormat {
Png,
Jpeg,
Gif,
Webp,
Svg,
Pdf,
}Expand description
The format of an image file that a conversion rule can list: one of the six kinds of image the library knows by name.
A file of another kind is still published, under its own media type, but
no conversion rule can list it and no converter is asked about it. In
settings, a format is written by its short name
(name): png, jpeg, gif, webp, svg,
pdf.
§Examples
use flm_core::stdlib::features::graphics::ImageFormat;
assert_eq!(ImageFormat::Pdf.media_type(), "application/pdf");
assert_eq!(ImageFormat::from_media_type("image/svg+xml"), Some(ImageFormat::Svg));
assert_eq!(ImageFormat::from_name("jpeg"), Some(ImageFormat::Jpeg));Variants§
Png
A PNG image, image/png: a grid of pixels.
Jpeg
A JPEG image, image/jpeg: a grid of pixels.
Gif
A GIF image, image/gif: a grid of pixels, possibly animated.
Webp
A WebP image, image/webp: a grid of pixels.
Svg
An SVG drawing, image/svg+xml.
A PDF document, application/pdf, whose first page is the drawing.
Implementations§
Source§impl ImageFormat
impl ImageFormat
Sourcepub const ALL: [ImageFormat; 6]
pub const ALL: [ImageFormat; 6]
The six formats, in the order of the enumeration’s variants.
Sourcepub fn media_type(self) -> &'static str
pub fn media_type(self) -> &'static str
Returns the format’s media type, such as image/png.
Sourcepub fn name(self) -> &'static str
pub fn name(self) -> &'static str
Returns the format’s short name, as settings write it, such as png.
Sourcepub fn from_media_type(media_type: &str) -> Option<ImageFormat>
pub fn from_media_type(media_type: &str) -> Option<ImageFormat>
Returns the format whose media type is media_type, if it is one of
the six.
Sourcepub fn from_name(name: &str) -> Option<ImageFormat>
pub fn from_name(name: &str) -> Option<ImageFormat>
Returns the format whose short name is name, if it is one of the
six.
Trait Implementations§
Source§impl Clone for ImageFormat
impl Clone for ImageFormat
impl Copy for ImageFormat
Source§impl Debug for ImageFormat
impl Debug for ImageFormat
Source§impl<'de> Deserialize<'de> for ImageFormat
impl<'de> Deserialize<'de> for ImageFormat
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for ImageFormat
impl Display for ImageFormat
impl Eq for ImageFormat
Source§impl Hash for ImageFormat
impl Hash for ImageFormat
Source§impl JsonSchema for ImageFormat
impl JsonSchema for ImageFormat
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl Ord for ImageFormat
impl Ord for ImageFormat
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ImageFormat
impl PartialEq for ImageFormat
Source§impl PartialOrd for ImageFormat
impl PartialOrd for ImageFormat
Source§impl Serialize for ImageFormat
impl Serialize for ImageFormat
impl StructuralPartialEq for ImageFormat
Auto Trait Implementations§
impl Forget for ImageFormat
impl Freeze for ImageFormat
impl Move for ImageFormat
impl RefUnwindSafe for ImageFormat
impl Send for ImageFormat
impl Sync for ImageFormat
impl Unpin for ImageFormat
impl UnsafeUnpin for ImageFormat
impl UnwindSafe for ImageFormat
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> ⓘ
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> ⓘ
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 more