API reference

aster_blueprint::theme

Pre-1.0: signatures are not frozen. Generated from rustdoc JSON of the compiled crate; rustdoc JSON format version 60. Only public items are listed.

Global themes and instance-local overrides over typed resource dictionaries.

A theme is the shared, global resource vocabulary of an application. A theme instance overlays local overrides on that vocabulary; overrides never mutate the base theme and never leak between instances.

Structs

structaster_blueprint::theme::Theme

pub struct Theme { /* see fields */ }

A global set of named resources.

Methods

  • fn new(name: Symbol) -> Self
  • fn name(&self) -> &Symbol
  • fn resources(&self) -> &ResourceDictionary
  • fn define(&mut self, name: Symbol, entry: ResourceEntry) -> Result<(), AssetError> — Authors a new named resource in this theme. A repeated name or an invalid entry is refused and the theme is left unchanged.
  • fn apply(&self, edits: &[ResourceEdit]) -> Result<Theme, AssetError> — Builds a candidate theme from a set of edits.
  • fn resolved(&self) -> Result<ResolvedResources, AssetError> — Effective values and types of this theme.
  • fn resource_types(&self) -> Result<BTreeMap<Symbol, ValueType>, AssetError> — Name to declared type map, the compiler environment resource seam.

Trait implementations: Clone, Debug, PartialEq, StructuralPartialEq

structaster_blueprint::theme::ThemeInstance

pub struct ThemeInstance { /* see fields */ }

One use of a theme with instance-local overrides.

The base theme is shared and never modified. Local overrides replace, patch or remove a name for this instance only.

Methods

  • fn new(base: impl Into<Arc<Theme>>) -> Self
  • fn base(&self) -> &Theme
  • fn overrides(&self) -> &ResourceDictionary
  • fn removed(&self) -> impl Iterator<Item = &Symbol>
  • fn override_resource(&mut self, name: Symbol, entry: ResourceEntry) -> Result<(), AssetError> — Applies instance-local edits.
  • fn remove_resource(&mut self, name: &Symbol) -> Result<(), AssetError>
  • fn rebase(&mut self, base: impl Into<Arc<Theme>>) -> Result<(), AssetError> — Explicit global-theme refresh preserving compatible local overrides. A failed alias/type/capacity validation leaves the instance unchanged.
  • fn apply(&mut self, edits: &[ResourceEdit]) -> Result<(), AssetError>
  • fn effective(&self) -> Result<ResourceDictionary, AssetError> — The effective dictionary of this instance: base entries, then local replacements, then local removals.
  • fn resolved(&self) -> Result<ResolvedResources, AssetError> — Effective values and types of this instance. Aliases resolve inside the effective dictionary, so an override is visible through the aliases of this instance and of no other.
  • fn resource_types(&self) -> Result<BTreeMap<Symbol, ValueType>, AssetError> — Name to declared type map of this instance.

Trait implementations: Clone, Debug, PartialEq, StructuralPartialEq