API reference

aster_blueprint::prepared_source

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.

Typed host/theme resolver glue over the prepared-value primitive.

This module is the narrow bridge that turns an already resolved authored resource dictionary into a runtime [RuntimeValue]. It borrows the caller's resources and the caller's handle map; it owns no dictionary, no counter, no cache and no protocol of its own, and it performs no implicit refresh.

Two seams are defined:

  • [resolve_host] admits a caller-owned [PreparedHandle] against a [ResourceArena]: the exact owning arena and live slot generation must match, the handle family must equal the caller's expected [ValueType], and only then is the existing payload cloned out.
  • [resolve_theme] reuses the already-resolved REAL theme dictionary: a literal wraps the actual authored literal, and a host entry resolves its declared HostResource.id through the same caller map at the exact declared type.

Missing names, foreign arenas, stale handles and type mismatches are explicit errors. There is no placeholder value, no synthesized fallback and no fake backend authority: a name that cannot be admitted is refused rather than substituted.

A Label handle is admitted through its payload only. The prepared label's own scale check and the caller's fit check stay with the caller as its retained commit gate; this resolver never selects a scale, never re-rasterizes and never claims that a label is presentable.

Structs

structaster_blueprint::prepared_source::PreparedResources

pub struct PreparedResources<'a> { /* see fields */ }

Borrowed adapter from an explicitly resolved theme and caller-owned arena handles to the actual runtime resource interface. It owns no cache and does not refresh a theme. Handle admission is repeated for each evaluation; already prepared immutable candidates keep their existing cloned payloads.

Methods

  • fn new(resources: &'a ResolvedResources, arena: &'a ResourceArena, handles: &'a BTreeMap<Symbol, PreparedHandle>) -> Self
  • fn resolve_value(&self, name: &Symbol, expected: ValueType) -> Result<RuntimeValue, PreparedSourceError> — Detailed admission for callers which need the exact refusal. The runtime trait's Option maps any refusal to existing ResourceUnavailable.

Trait implementations: ResourceResolver

Enums

enumaster_blueprint::prepared_source::PreparedHandle

pub enum PreparedHandle { Paint, Drawing, Label, Surface }

A caller-owned typed handle to one prepared family.

The variant is the resource family, so a drawing handle can never be admitted where a paint is expected by the exact runtime family check. This adds no new ID and registers nothing: the wrapped handles are the existing process-local arena handles, and the caller keeps them in its own map.

Methods

  • fn value_type(&self) -> ValueType — The resource family this handle names.

Variants

  • Paint — An existing paint retained by the arena.
  • Drawing — An existing retained recording retained by the arena.
  • Label — An existing measured label retained by the arena.
  • Surface — A caller-owned surface: nothing, an existing paint or an existing recording.

Trait implementations: Clone, Copy, Debug, Eq, PartialEq, StructuralPartialEq

enumaster_blueprint::prepared_source::PreparedSourceError

pub enum PreparedSourceError { Missing, ForeignArena, StaleHandle, KindMismatch, TypeMismatch }

Refusal of a prepared-source resolution.

Every variant names a reason only. No error echoes an authored literal, recording command, paint component, label content or host payload.

Variants

  • Missing — The caller map (or resolved dictionary) has no entry for the name.
  • ForeignArena — The handle belongs to a different arena than the one supplied.
  • StaleHandle — The handle was removed, or its slot was reused, since it was issued.
  • KindMismatch — The arena slot behind the handle holds a different resource family.
  • TypeMismatch — The expected declared type does not match the handle family.

Trait implementations: Clone, Debug, Display, Eq, Error, PartialEq, StructuralPartialEq

enumaster_blueprint::prepared_source::SurfaceHandle

pub enum SurfaceHandle { None, Paint, Recording }

A caller-owned typed handle to one surface family.

None is an explicit caller decision: it means "this surface paints nothing". It is not a missing entry — a name absent from the caller's map is still refused as [PreparedSourceError::Missing]. The paint and recording variants wrap the existing arena handles, so a surface reuses the existing arena admission instead of minting a new slot, a new identity or a new registry entry.

Variants

  • None — No surface is painted for this state.
  • Paint — An existing paint retained by the arena.
  • Recording — An existing retained recording retained by the arena.

Trait implementations: Clone, Copy, Debug, Eq, PartialEq, StructuralPartialEq

Functions

fnaster_blueprint::prepared_source::resolve_host

pub fn resolve_host(arena: &resources::ResourceArena, handles: &std::collections::BTreeMap<model::Symbol, PreparedHandle>, name: &model::Symbol, expected: model::ValueType) -> Result<prepared::RuntimeValue, PreparedSourceError>

Resolves a caller-owned host handle into a runtime value.

The order is exact and mandatory:

  1. The name must be present in the caller's borrowed handles map; otherwise [PreparedSourceError::Missing] is returned.
  2. The handle must pass exact typed arena owner and slot generation admission against arena; a foreign arena is [PreparedSourceError::ForeignArena] and a removed/reused handle is [PreparedSourceError::StaleHandle]. No implicit refresh or re-resolve happens.
  3. The handle family must equal expected; otherwise [PreparedSourceError::TypeMismatch].
  4. Only then is the existing payload cloned out: a Paint clone, an Arc<Recording> clone (shared, not copied) or a Label clone of its measured metrics.

Admission reads the arena only; it never mutates it, so a refused resolve leaves both the arena and the caller map untouched. A label is admitted by payload alone; its scale and fit remain the caller's commit gate.

fnaster_blueprint::prepared_source::resolve_theme

pub fn resolve_theme(resources: &asset::ResolvedResources, arena: &resources::ResourceArena, handles: &std::collections::BTreeMap<model::Symbol, PreparedHandle>, name: &model::Symbol) -> Result<prepared::RuntimeValue, PreparedSourceError>

Resolves an already-resolved REAL theme entry into a runtime value.

resources is the caller's existing [ResolvedResources] (from Theme::resolved or ThemeInstance::resolved); this function reuses that dictionary and builds no second one:

  • a [ResolvedValue::Literal] wraps the actual authored literal, already typed by the dictionary;
  • a [ResolvedValue::Host] resolves the declared HostResource.id through the same caller handles map, at the exact declared HostResource.value_type, using the same admission as [resolve_host].

Aliases resolve inside the already-resolved dictionary, so an instance override is visible only through that instance's dictionary. A name absent from resources is [PreparedSourceError::Missing], and any host refusal is reported verbatim.