mirror of
https://github.com/salsa-rs/salsa.git
synced 2024-12-27 23:06:50 +00:00
2e9b418bbb
- extend some of the empty sections, add a new common pattern - also, show how to use anchors and include so we can test the sources for common patterns
16 lines
373 B
Rust
16 lines
373 B
Rust
use super::*;
|
|
|
|
// ANCHOR: util1
|
|
#[salsa::query_group(Request)]
|
|
trait RequestUtil: RequestParser {
|
|
fn content_type(&self) -> Option<String>;
|
|
}
|
|
|
|
fn content_type(db: &impl RequestUtil) -> Option<String> {
|
|
db.parse()
|
|
.header
|
|
.iter()
|
|
.find(|header| header.key == "content-type")
|
|
.map(|header| header.value.clone())
|
|
}
|
|
// ANCHOR_END: util1
|