Skip to content

Commit

Permalink
Add function for getting favicon.ico
Browse files Browse the repository at this point in the history
  • Loading branch information
lindhe committed Aug 9, 2023
1 parent 9fe7ce5 commit 945384f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use rocket::fs::NamedFile;
use rocket::http::ContentType;
use std::path::Path;
use webicons::*;

#[macro_use]
Expand All @@ -23,6 +25,13 @@ fn foo() -> (ContentType, String) {
(ContentType::HTML, html.to_string())
}

#[get("/favicon.ico")]
async fn get_favicon() -> Option<NamedFile> {

Check warning on line 29 in src/main.rs

View workflow job for this annotation

GitHub Actions / Clippy

warning: function `get_favicon` is never used --> src/main.rs:29:10 | 29 | async fn get_favicon() -> Option<NamedFile> { | ^^^^^^^^^^^ | = note: `#[warn(dead_code)]` on by default

Check warning on line 29 in src/main.rs

View workflow job for this annotation

GitHub Actions / Clippy

warning: function `get_favicon` is never used --> src/main.rs:29:10 | 29 | async fn get_favicon() -> Option<NamedFile> { | ^^^^^^^^^^^ | = note: `#[warn(dead_code)]` on by default

Check warning on line 29 in src/main.rs

View workflow job for this annotation

GitHub Actions / cargo-test

function `get_favicon` is never used
NamedFile::open(Path::new("favicons/favicon.ico"))
.await
.ok()
}

#[launch]
fn rocket() -> _ {
rocket::build().mount("/", routes![emoji, foo])
Expand Down

0 comments on commit 945384f

Please sign in to comment.