Skip to main content

theme_serialize_batch

Function theme_serialize_batch 

Source
pub fn theme_serialize_batch<'a>(
    entries: impl IntoIterator<Item = (&'a ThemeConfig, ThemeRoutePolicy)>,
    options: ThemeBatchOptions,
) -> Result<ThemeBatchSerializationReport>
Expand description

Serialize route-scoped theme configs with stable optimizer cache keys.

use dioxus_theme_core::prelude::*;

let config = theme().with_default_theme("dark");
let policy = theme_route_policy().route("/settings");
let batch = theme_serialize_batch([(&config, policy)], ThemeBatchOptions::default())?;

assert_eq!(batch.payloads.len(), 1);
assert!(batch.total_bytes > 0);