[−][src]Struct favy::Favicon
A comprehensive favicon encoder.
Example
use favy::{resample, encode::Encode, Image, Favicon, Size}; fn main() -> io::Result<()> { // Initialize the icon let mut icon = Favicon::new(); // Add a single entry let image = Image::open("example.png")?; icon.add_entry(resample::linear, &image, Size(32))?; // Add multiple entries icon.add_entries( resample::linear, &image, vec![Size(64), Size(128), Size(256)] )?; // Save the icon to disk icon.save("~/favicon/") }
Methods
impl Favicon
[src]
pub fn apple_touch(&mut self, b: bool) -> &mut Self
[src]
Indicates that the outputted html-helper should contain link tags for apple-touch icons.
This option defaults to false
.
Example
let fav = Favicon::new().apple_touch(true);
<link rel="apple-touch-icon-precomposed" sizes="196x196" href="icons/favicon0.png">
<link rel="icon" sizes="196x196" href="icons/favicon0.png">
pub fn web_app(&mut self, b: bool) -> &mut Self
[src]
Indicates that the output of self.write
or
self.save
should contain a serialize.webmanifest
file to assist on creating
PWA icons.
This option defaults to false
.
Example
let fav = Favicon::new().web_app(true);
...
<link rel="serialize" href="serialize.webmanifest">
{
icons: [
{
src: "icons/favicon0.png",
sizes: "196x196",
type: "image/png"
}
]
}
pub fn html_helper(&self) -> Result<Vec<u8>>
[src]
Returns a buffer containing HTML link tags to assist on the creating of the icon.
pub fn manisfest(&self) -> Result<Vec<u8>>
[src]
Returns a buffer containing a JSON helper for web manisfests.
Trait Implementations
impl Clone for Favicon
[src]
impl Debug for Favicon
[src]
impl Encode for Favicon
[src]
type Key = Size
fn with_capacity(capacity: usize) -> Self
[src]
fn len(&self) -> usize
[src]
fn add_entry<F: FnMut(&DynamicImage, u32) -> Result<DynamicImage>>(
&mut self,
filter: F,
source: &Image,
key: Self::Key
) -> Result<&mut Self, EncodingError<Self::Key>>
[src]
&mut self,
filter: F,
source: &Image,
key: Self::Key
) -> Result<&mut Self, EncodingError<Self::Key>>
fn new() -> Self
[src]
fn add_entries<F, I>(
&mut self,
filter: F,
source: &Image,
keys: I
) -> Result<&mut Self, EncodingError<Self::Key>> where
F: FnMut(&DynamicImage, u32) -> Result<DynamicImage, Error>,
I: IntoIterator<Item = Self::Key>,
[src]
&mut self,
filter: F,
source: &Image,
keys: I
) -> Result<&mut Self, EncodingError<Self::Key>> where
F: FnMut(&DynamicImage, u32) -> Result<DynamicImage, Error>,
I: IntoIterator<Item = Self::Key>,
impl Save for Favicon
[src]
Auto Trait Implementations
impl Send for Favicon
impl Sync for Favicon
impl Unpin for Favicon
impl UnwindSafe for Favicon
impl RefUnwindSafe for Favicon
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
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>,
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> 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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Save for T where
T: Write,
[src]
T: Write,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,