Skip to main content

StyleResolver

Trait StyleResolver 

Source
pub trait StyleResolver {
    // Required method
    fn resolve(&self, role: StyleRole) -> Option<StyleBundle>;

    // Provided method
    fn revision(&self) -> u64 { ... }
}
Expand description

Optional host policy for built-in or application-defined StyleRoles.

Returned bundles overlay the active StyleSheet defaults. Resolvers are expected to be cheap and side-effect free. A resolver with interior mutable policy should increment revision whenever its answers change so measurement caches can invalidate.

Required Methods§

Source

fn resolve(&self, role: StyleRole) -> Option<StyleBundle>

Resolve role, or return None to keep the stylesheet/default result.

Provided Methods§

Source

fn revision(&self) -> u64

Monotonic policy revision for cache invalidation.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§