[−][src]Struct identicon_rs::Identicon
Generic Identicon struct
This is the base struct to be used.
Implementations
impl Identicon
[src]
pub fn new<T>(input_value: T) -> Self where
T: AsRef<str>,
[src]
T: AsRef<str>,
Generates a new identicon
The defaults are:
- border: 50
- size: 5
- scale: 500
- background_color: (240, 240, 240)
pub fn border(self, border: u32) -> Self
[src]
Sets the identicon border size.
Default is 5
pub fn size(self, size: u32) -> Result<Self, IdenticonError>
[src]
Sets the number of viewable blocks of the identicon.
This must be <= the scale.
Default is 5x5
pub fn scale(self, scale: u32) -> Result<Self, IdenticonError>
[src]
Sets the scale of the image.
The scale plus 2 times the border is the final pixel size of the image.
This must be >= the size.
Default is 500
pub fn background_color(self, background_color: (u8, u8, u8)) -> Self
[src]
Sets the background, non-active color of the identicon.
This is a tuble of (red, green, blue) values.
Default is (240, 240, 240)
pub fn generate_image(&self) -> DynamicImage
[src]
Generates the DynamicImage representing the Identicon
pub fn save_image(&self, output_filename: &str) -> Result<(), IdenticonError>
[src]
Saves the generated image to the given filename
The file formats .png
, .jpg
, .jpeg
, .bmp
, and .ico
work.
pub fn export_png_data(&self) -> Result<Vec<u8>, IdenticonError>
[src]
Export a PNG file buffer as a Vec
This is for creating a file for a buffer or network response without creating a file on the filesystem.
pub fn export_jpeg_data(&self) -> Result<Vec<u8>, IdenticonError>
[src]
Export a JPEG file buffer as a Vec
This is for creating a file for a buffer or network response without creating a file on the filesystem.
Trait Implementations
impl Clone for Identicon
[src]
impl Debug for Identicon
[src]
impl Eq for Identicon
[src]
impl Hash for Identicon
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for Identicon
[src]
fn cmp(&self, other: &Identicon) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Identicon> for Identicon
[src]
impl PartialOrd<Identicon> for Identicon
[src]
fn partial_cmp(&self, other: &Identicon) -> Option<Ordering>
[src]
fn lt(&self, other: &Identicon) -> bool
[src]
fn le(&self, other: &Identicon) -> bool
[src]
fn gt(&self, other: &Identicon) -> bool
[src]
fn ge(&self, other: &Identicon) -> bool
[src]
impl StructuralEq for Identicon
[src]
impl StructuralPartialEq for Identicon
[src]
Auto Trait Implementations
impl RefUnwindSafe for Identicon
impl Send for Identicon
impl Sync for Identicon
impl Unpin for Identicon
impl UnwindSafe for Identicon
Blanket Implementations
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
D: AdaptFrom<S, Swp, Dwp, T>,
Dwp: WhitePoint,
Swp: WhitePoint,
T: Component + Float,
[src]
D: AdaptFrom<S, Swp, Dwp, T>,
Dwp: WhitePoint,
Swp: WhitePoint,
T: Component + Float,
fn adapt_into_using<M>(self, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
[src]
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into(self) -> D
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> ConvertInto<U> for T where
U: ConvertFrom<T>,
[src]
U: ConvertFrom<T>,
fn convert_into(self) -> U
[src]
fn convert_unclamped_into(self) -> U
[src]
fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,