[][src]Struct iconwriter::Icon

pub struct Icon<'a> { /* fields omitted */ }

A generic representation of an icon.

Implementations

impl<'a> Icon<'a>[src]

pub fn new(icon_type: IconType, capacity: usize) -> Self[src]

Creates an Icon instance.

Arguments

  • icon_type The type of the returned icon.
  • capacity The target capacity for the underliyng HashMap<IconOptions, &SourceImage>.

It is important to note that although the returned Icon has the capacity specified, the Icon will have zero sizes. For an explanation of the difference between length and capacity, see Capacity and reallocation.

pub fn ico(capacity: usize) -> Self[src]

Creates an Icon with the Ico icon type.

Arguments

  • capacity The target capacity for the underliyng HashMap<IconOptions, &SourceImage>.

It is important to note that although the returned Icon has the capacity specified, the Icon will have zero sizes. For an explanation of the difference between length and capacity, see Capacity and reallocation.

pub fn icns(capacity: usize) -> Self[src]

Creates an Icon with the Icns icon type.

Arguments

  • capacity The target capacity for the underliyng HashMap<IconOptions, &SourceImage>.

It is important to note that although the returned Icon has the capacity specified, the Icon will have zero sizes. For an explanation of the difference between length and capacity, see Capacity and reallocation.

pub fn png_sequence(capacity: usize) -> Self[src]

Creates an Icon with the PngSequece icon type.

Arguments

  • capacity The target capacity for the underliyng HashMap<IconOptions, &SourceImage>.

It is important to note that although the returned Icon has the capacity specified, the Icon will have zero sizes. For an explanation of the difference between length and capacity, see Capacity and reallocation.

pub fn add_size(&mut self, size: Size, source: &'a SourceImage) -> Result<()>[src]

Adds a size binding to the icon.

Returns Err(_) if the specified size is invalid or is already included in the Icon. Returns Ok(()) otherwise.

pub fn add_sizes<I: ExactSizeIterator<Item = Size>>(
    &mut self,
    sizes: I,
    source: &'a SourceImage
) -> Result<()>
[src]

Adds a series sizes binding to the icon.

Returns Err(_) if any of the specified sizes is invalid or is already included in the Icon. Returns Ok(()) otherwise.

pub fn remove_size(&mut self, size: Size) -> Option<&SourceImage>[src]

Remove a size binding from the icon.

Returns Some(&SourceImage) if the icon contains a size binding associated with the opts argument. Returns None otherwise.

pub fn sizes(&self) -> Vec<Size>[src]

Returns a list of all sizes listed in all icon's sizes.

pub fn n_sizes(&self) -> usize[src]

Returns the total number of sizes in all icon's sizes.

This method avoids allocating unnecessary resources when accessing self.sizes().len().

pub fn contains_size(&self, size: Size) -> bool[src]

Returns true if self.source_map contains size. Otherwise returns false.

This method avoids allocating unnecessary resources when accessing self.sizes().includes(&size).

pub fn rasterize<F: FnMut(&SourceImage, Size) -> Result<RgbaImage>>(
    &self,
    resampler: F
) -> Result<Vec<RgbaImage>>
[src]

pub fn write<W: Write, F: FnMut(&SourceImage, Size) -> Result<RgbaImage>>(
    &self,
    w: W,
    resampler: F
) -> Result<()>
[src]

Writes the icon to a file or stream.

Trait Implementations

impl<'a> AsRef<HashMap<u32, &'a SourceImage, RandomState>> for Icon<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Icon<'a>

impl<'a> !Send for Icon<'a>

impl<'a> !Sync for Icon<'a>

impl<'a> Unpin for Icon<'a>

impl<'a> UnwindSafe for Icon<'a>

Blanket Implementations

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> From<T> for T[src]

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

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> SetParameter for T

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.