[−][src]Struct icon_baker::Icon
A generic representation of an icon.
Methods
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 underliyngHashMap<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 ico(capacity: usize) -> Self
[src]
Creates an Icon
with the Ico
icon type.
Arguments
capacity
The target capacity for the underliyngHashMap<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 underliyngHashMap<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 underliyngHashMap<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 add_entry(&mut self, opts: Entry, 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: &Entry) -> 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<Entry, &'a SourceImage, RandomState>> for Icon<'a>
[src]
fn as_ref(&self) -> &HashMap<Entry, &'a SourceImage>
[src]
Auto Trait Implementations
impl<'a> !Send for Icon<'a>
impl<'a> Unpin for Icon<'a>
impl<'a> !Sync for Icon<'a>
impl<'a> UnwindSafe for Icon<'a>
impl<'a> RefUnwindSafe for Icon<'a>
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
Sets value
as a parameter of self
.