fusible 0.20.3

Electronic linter: a fuse that blows to block firmware code generation
1
2
3
4
5
6
7
8
9
10
11
use tiny_http::{Request, Response};

use super::assets::static_response;
use super::state::State;

pub(super) fn serve_static(request: Request, state: &State, path: &str) {
    let bundle = state.bundle.lock().ok().and_then(|lock| lock.clone());
    let response = static_response(path, bundle, state.desktop)
        .unwrap_or_else(|| Response::from_string("Not Found").with_status_code(404));
    let _ = request.respond(response);
}