pub struct ScalarConfig {Show 13 fields
pub theme: ScalarTheme,
pub dark_mode: bool,
pub hide_search: bool,
pub hide_dark_mode_toggle: bool,
pub show_sidebar: bool,
pub layout: ScalarLayout,
pub hide_models: bool,
pub hide_client_button: bool,
pub document_download: DocumentDownload,
pub show_developer_tools: DeveloperTools,
pub agent_enabled: bool,
pub mcp_enabled: bool,
pub cdn_url: Option<String>,
}Expand description
Scalar UI rendering options.
All fields default to the values the crate has shipped since the
initial Scalar adoption — constructing ScalarConfig::default() and
passing it to MountOpts::scalar is a
no-op compared to omitting the call entirely.
§Example
use doxa::{ScalarConfig, ScalarLayout, ScalarTheme};
let cfg = ScalarConfig::default()
.layout(ScalarLayout::Classic)
.theme(ScalarTheme::Solarized)
.dark_mode(false);Fields§
§theme: ScalarThemeVisual theme. Defaults to ScalarTheme::Default.
dark_mode: boolInitial dark mode state. Defaults to true. The user-facing
toggle remains visible unless Self::hide_dark_mode_toggle is
set.
hide_search: boolHide the search box. Defaults to false.
hide_dark_mode_toggle: boolHide the dark-mode toggle in the header. Defaults to false.
Show the left sidebar. Defaults to true.
layout: ScalarLayoutPage layout. Defaults to ScalarLayout::Modern (three-pane
nav / description / playground).
hide_models: boolHide the standalone “Models” / schemas index. Defaults to true
— referenced schemas still render inline under each operation.
Hide the “copy as curl/node/…” codegen button row. Defaults to
true. The interactive try-it-out panel is unaffected.
document_download: DocumentDownloadFormat offered by the header “Download OpenAPI” button. Defaults
to DocumentDownload::None — the spec is still reachable at
the mounted JSON path.
show_developer_tools: DeveloperToolsWhen the developer-tools drawer is exposed. Defaults to
DeveloperTools::Never.
agent_enabled: boolEnable Scalar’s “Ask AI” assistant. Defaults to false. Scalar
charges for production use of this feature; leaving it off keeps
the docs UI free of upsell surface.
mcp_enabled: boolEnable Scalar’s “Generate MCP” integration. Defaults to false
for the same reason as Self::agent_enabled.
cdn_url: Option<String>Override the Scalar CDN URL. None keeps the crate’s default
(https://cdn.jsdelivr.net/npm/@scalar/api-reference). Useful
for air-gapped deployments, CDN mirrors, or self-hosted Scalar
bundles — set this to the URL of the @scalar/api-reference
script the browser should load.
This field is skipped during JSON serialization — it is a server-side concern only (the URL is written into the HTML template, not handed to Scalar as configuration).
Implementations§
Source§impl ScalarConfig
impl ScalarConfig
Sourcepub fn theme(self, theme: ScalarTheme) -> Self
pub fn theme(self, theme: ScalarTheme) -> Self
Override the visual theme.
Sourcepub fn layout(self, layout: ScalarLayout) -> Self
pub fn layout(self, layout: ScalarLayout) -> Self
Override the page layout.
Sourcepub fn hide_dark_mode_toggle(self, hide: bool) -> Self
pub fn hide_dark_mode_toggle(self, hide: bool) -> Self
Hide or show the dark-mode toggle.
Sourcepub fn hide_search(self, hide: bool) -> Self
pub fn hide_search(self, hide: bool) -> Self
Hide or show the search box.
Show or hide the left sidebar.
Sourcepub fn hide_models(self, hide: bool) -> Self
pub fn hide_models(self, hide: bool) -> Self
Hide or show the standalone schemas index.
Hide or show the codegen button row.
Sourcepub fn document_download(self, format: DocumentDownload) -> Self
pub fn document_download(self, format: DocumentDownload) -> Self
Configure the header download button format.
Sourcepub fn show_developer_tools(self, when: DeveloperTools) -> Self
pub fn show_developer_tools(self, when: DeveloperTools) -> Self
Configure when the developer-tools drawer is exposed.
Sourcepub fn agent_enabled(self, on: bool) -> Self
pub fn agent_enabled(self, on: bool) -> Self
Enable or disable Scalar’s “Ask AI” agent.
Sourcepub fn mcp_enabled(self, on: bool) -> Self
pub fn mcp_enabled(self, on: bool) -> Self
Enable or disable Scalar’s “Generate MCP” integration.
Sourcepub fn cdn_url(self, url: impl Into<String>) -> Self
pub fn cdn_url(self, url: impl Into<String>) -> Self
Override the Scalar CDN URL. See Self::cdn_url for when to
use this.
Trait Implementations§
Source§impl Clone for ScalarConfig
impl Clone for ScalarConfig
Source§fn clone(&self) -> ScalarConfig
fn clone(&self) -> ScalarConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more