salsa/examples/selection/util1.rs

17 lines
372 B
Rust
Raw Normal View History

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