summaryrefslogtreecommitdiffstats
path: root/vendor/rust-analyzer-salsa/examples/selection/util1.rs
blob: 6b2ad91c7c4dad6847f87dbcbcabb4c32de7755f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use super::*;

// ANCHOR: util1
#[salsa::query_group(Request)]
trait RequestUtil: RequestParser {
    fn content_type(&self) -> Option<String>;
}

fn content_type(db: &dyn RequestUtil) -> Option<String> {
    db.parse()
        .header
        .iter()
        .find(|header| header.key == "content-type")
        .map(|header| header.value.clone())
}
// ANCHOR_END: util1