Skip to main content

hoverfx_serialize_batch

Function hoverfx_serialize_batch 

Source
pub fn hoverfx_serialize_batch<'a>(
    entries: impl IntoIterator<Item = (&'a HoverFxConfig, HoverFxRoutePolicy)>,
    options: HoverFxBatchOptions,
) -> Result<HoverFxBatchSerializationReport, Error>
Expand description

Serialize route-scoped HoverFX configs with stable cache keys.

use dioxus_hoverfx_core::prelude::*;

let config = hoverfx().with_default_effect(HoverFxPreset::Spotlight.as_attr());
let policy = hoverfx_route_policy().route("/gallery");
let batch = hoverfx_serialize_batch([(&config, policy)], HoverFxBatchOptions::default())?;

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