#[non_exhaustive]pub enum ImageSize {
S16,
S32,
S64,
S128,
S256,
S512,
S1024,
S2048,
S4096,
}Expand description
The size of an image: a power of two from 16 to 4096 pixels (D-139).
discord.js counterpart: ImageSize (discord-api-types).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
S16
16 pixels.
S32
32 pixels.
S64
64 pixels.
S128
128 pixels.
S256
256 pixels.
S512
512 pixels.
S1024
1024 pixels.
S2048
2048 pixels.
S4096
4096 pixels.
Implementations§
Source§impl ImageSize
impl ImageSize
Sourcepub const fn pixels(self) -> u16
pub const fn pixels(self) -> u16
The size in pixels.
discord.js counterpart: the size of ImageURLOptions (@discordjs/rest).
Sourcepub const fn from_pixels(pixels: u16) -> Option<Self>
pub const fn from_pixels(pixels: u16) -> Option<Self>
The size for pixels, if it is a power of two from 16 to 4096.
discord.js counterpart: the size of ImageURLOptions (@discordjs/rest).
§Examples
use djs_rest::cdn::ImageSize;
assert_eq!(ImageSize::from_pixels(512), Some(ImageSize::S512));
assert_eq!(ImageSize::from_pixels(500), None);Trait Implementations§
impl Copy for ImageSize
impl Eq for ImageSize
Source§impl Ord for ImageSize
impl Ord for ImageSize
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for ImageSize
impl PartialOrd for ImageSize
impl StructuralPartialEq for ImageSize
Auto Trait Implementations§
impl Freeze for ImageSize
impl RefUnwindSafe for ImageSize
impl Send for ImageSize
impl Sync for ImageSize
impl Unpin for ImageSize
impl UnsafeUnpin for ImageSize
impl UnwindSafe for ImageSize
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,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§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.