pub struct DocsConfig { /* private fields */ }Expand description
Builder for constructing a DocsRegistry.
§Example
ⓘ
let registry = DocsConfig::new(nav_json, content_map)
.with_openapi("api-reference", spec_yaml)
.with_default_path("getting-started/introduction")
.build();Implementations§
Source§impl DocsConfig
impl DocsConfig
Sourcepub fn new(
nav_json: &str,
content_map: HashMap<&'static str, &'static str>,
) -> Self
pub fn new( nav_json: &str, content_map: HashMap<&'static str, &'static str>, ) -> Self
Create a new builder from a _nav.json string and a content map.
The content map is typically generated by build.rs using include_str!().
Sourcepub fn with_openapi(self, prefix: &str, yaml: &str) -> Self
pub fn with_openapi(self, prefix: &str, yaml: &str) -> Self
Add an OpenAPI specification.
prefix: The URL prefix for this spec’s endpoints (e.g. “api-reference”).yaml: The raw YAML string of the OpenAPI spec.
Sourcepub fn with_default_path(self, path: &str) -> Self
pub fn with_default_path(self, path: &str) -> Self
Set the default documentation path for redirects.
Defaults to the first page in the first nav group if not set.
Sourcepub fn with_api_group_name(self, name: &str) -> Self
pub fn with_api_group_name(self, name: &str) -> Self
Set the display name for the API Reference sidebar group.
Defaults to “API Reference”.
Sourcepub fn with_theme(self, theme: &str) -> Self
pub fn with_theme(self, theme: &str) -> Self
Set a single theme (no toggle button).
The theme name must match a DaisyUI theme defined in the consumer’s tailwind.css.
Sourcepub fn with_theme_toggle(self, light: &str, dark: &str, default: &str) -> Self
pub fn with_theme_toggle(self, light: &str, dark: &str, default: &str) -> Self
Enable a light/dark theme toggle.
light: Name of the light DaisyUI theme.dark: Name of the dark DaisyUI theme.default: Which of the two to use on first visit (lightordark).
Sourcepub fn build(self) -> DocsRegistry
pub fn build(self) -> DocsRegistry
Build the DocsRegistry.
Parses all documents, builds the search index, and parses OpenAPI specs.
Auto Trait Implementations§
impl Freeze for DocsConfig
impl RefUnwindSafe for DocsConfig
impl Send for DocsConfig
impl Sync for DocsConfig
impl Unpin for DocsConfig
impl UnwindSafe for DocsConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
Source§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Create an instance of this type from an initialization function
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<Ret> SpawnIfAsync<(), Ret> for Ret
impl<Ret> SpawnIfAsync<(), Ret> for Ret
Source§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
Source§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
Source§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
Source§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.