pub struct BlogConfig { /* private fields */ }Expand description
Builder for constructing a BlogRegistry.
§Example
ⓘ
let registry = BlogConfig::new(include_str!("../blog/_blog.json"), blog_content_map())
.with_posts_per_page(9)
.with_theme_toggle("light", "dark", "dark")
.build();Implementations§
Source§impl BlogConfig
impl BlogConfig
Sourcepub fn new(
manifest_json: &str,
content_map: HashMap<&'static str, &'static str>,
) -> Self
pub fn new( manifest_json: &str, content_map: HashMap<&'static str, &'static str>, ) -> Self
Create a new builder from a _blog.json string and a content map.
Sourcepub fn with_posts_per_page(self, n: usize) -> Self
pub fn with_posts_per_page(self, n: usize) -> Self
Set the number of posts per page for pagination (default: 9).
Sourcepub fn with_date_format(self, fmt: &str) -> Self
pub fn with_date_format(self, fmt: &str) -> Self
Set the date display format (default: “%B %d, %Y”).
Sourcepub fn with_theme(self, theme: &str) -> Self
pub fn with_theme(self, theme: &str) -> Self
Set a single theme (no toggle button).
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.
Sourcepub fn build(self) -> BlogRegistry
pub fn build(self) -> BlogRegistry
Build the BlogRegistry.
Auto Trait Implementations§
impl Freeze for BlogConfig
impl RefUnwindSafe for BlogConfig
impl Send for BlogConfig
impl Sync for BlogConfig
impl Unpin for BlogConfig
impl UnsafeUnpin for BlogConfig
impl UnwindSafe for BlogConfig
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.