[][src]Struct iconwriter::Icon

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

A generic representation of an icon.

Implementations

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

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 entries. 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 entries. 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 entries. For an explanation of the difference between length and capacity, see Capacity and reallocation.

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

pub fn add_entry(
    &mut self,
    opts: IconOptions,
    source: &'a SourceImage
) -> Result<()>
[src]

Adds an entry to the icon.

Returns Err(Error::SizeAlreadyIncluded(Size)) if any of the sizes listed in opts.sizes() is already associated to another entry. Otherwise returns Ok(()).

pub fn remove_entry(&mut self, opts: &IconOptions) -> Option<&SourceImage>[src]

Remove an entry from the icon.

Returns Some(&SourceImage) if the icon contains an entry 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 entries.

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

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

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

pub fn raster(&self) -> Result<Vec<RgbaImage>>[src]

pub fn write<W: Write + Seek>(&self, w: W) -> Result<()>[src]

Writes the icon to a file or stream.

Trait Implementations

impl<'a> AsRef<HashMap<IconOptions, &'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.