lib_humus/query_settings.rs
1// SPDX-FileCopyrightText: 2026 Slatian <baschdel@disroot.org>
2//
3// SPDX-License-Identifier: AGPL-3.0-or-later
4
5use crate::language::UnicodeLanguageIdentifier;
6use crate::templating::HumusFormatIdentifier;
7
8/// Provides context from the query for use in the [crate::HumusEngine].
9///
10/// Its main job is the provide the requested format
11/// and the preferred language so that the Engine knows
12/// which output to produce.
13///
14/// For a default implementation see [TemplateSetting][crate::middleware::TemplateSetting].
15pub trait HumusQuerySettings: Clone {
16 /// Returns the requested output format.
17 fn get_format(&self) -> HumusFormatIdentifier;
18
19 /// Returns the preferred language for the template
20 fn get_preferred_language(&self) -> Option<UnicodeLanguageIdentifier>;
21}