[][src]Struct identicon_rs::Identicon

pub struct Identicon { /* fields omitted */ }

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]

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]

impl Ord for Identicon[src]

impl PartialEq<Identicon> for Identicon[src]

impl PartialOrd<Identicon> for Identicon[src]

impl StructuralEq for Identicon[src]

impl StructuralPartialEq for Identicon[src]

Auto Trait Implementations

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]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> ConvertInto<U> for T where
    U: ConvertFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> SetParameter for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.