API reference

aster_blueprint::canvas

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.

Authoring workbench canvas over a blueprint graph source.

This slice draws an authoring view of a [GraphSource]: one card per placed node, one anchor per input/output port and one connection line per authored connection. It is not a runtime renderer, not an application widget tree and not an action router.

Ownership rules:

  • The canvas never mutates the graph. Node positions live in the caller's [NodePlacement] list and are authoring-only.
  • The canvas never authorizes anything. [Canvas::hit_test] reports which authoring node, port or pan intent a canvas point refers to. It never reports an application action, a current value or an acknowledgement.
  • The canvas owns no clock, no OS handle, no backend session and no credential. It reads only the graph, the caller's view and style.

Everything is drawn with the existing Aster primitives: the canvas returns an immutable [Recording] that the caller renders with its own aster_ui::Renderer. Connection lines are Aster vector commands, so the caller's renderer must have vector capacity admitted (Renderer::enable_vectors); [Canvas::vector_limits] returns a bounded starting admission policy; actual renderer preflight remains authoritative.

First-slice limit: cards carry no text. Prepared labels are caller-owned and are not part of this slice, so every card reserves an empty label band. See docs/1.0/blueprint/CANVAS.md.

Structs

structaster_blueprint::canvas::Canvas

pub struct Canvas { /* see fields */ }

A built authoring canvas: an immutable recording plus its geometry.

Methods

  • fn recording(&self) -> &Arc<Recording> — The immutable recording the caller renders with its own renderer.
  • fn geometry(&self) -> &CanvasGeometry — The authoring geometry of this canvas.
  • fn hit_test(&self, point: [f64; 2]) -> CanvasHit — Resolves a canvas logical point to an authoring target.
  • fn vector_limits(&self) -> VectorLimits — Vector admission policy for this canvas' connection lines.

Trait implementations: Debug

structaster_blueprint::canvas::CanvasGeometry

pub struct CanvasGeometry { /* see fields */ }

The geometry the caller needs to draw overlays and resolve pointer input.

Public fields

fieldtype
viewCanvasView
nodesVec<NodeCard>Drawn cards, in graph node order.
portsVec<PortAnchor>Drawn port anchors.
wiresVec<Wire>Drawn connection lines.
unanchored_wiresusizeConnections that exist in the graph but whose endpoints are not both placed in this authoring view, so no line could be anchored.
port_hit_radiusf64Canvas logical radius that still selects a port anchor.

Trait implementations: Clone, Debug, PartialEq, StructuralPartialEq

structaster_blueprint::canvas::CanvasLimits

pub struct CanvasLimits { /* see fields */ }

Bounded authoring budget. Every count is checked before recording.

Public fields

fieldtype
nodesusizeMaximum number of node cards.
portsusizeMaximum number of port anchors.
wiresusizeMaximum number of connection lines.
commandsusizeMaximum number of recording commands. Also the recorder's own limit.
min_zoomf64Smallest admitted zoom factor.
max_zoomf64Largest admitted zoom factor.
max_extentf64Largest admitted absolute graph-space coordinate.

Methods

  • fn validate(self) -> Result<Self, CanvasError> — Rejects a budget that cannot be honoured before any drawing happens.

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

structaster_blueprint::canvas::CanvasStyle

pub struct CanvasStyle { /* see fields */ }

Authoring appearance. Sizes are graph-space units; the view's zoom maps them into canvas logical space.

Public fields

fieldtype
card_fillaster_ui::Srgb8
card_borderaster_ui::Srgb8
port_fillaster_ui::Srgb8
wire_coloraster_ui::Srgb8
wire_widthf32Stroke width in canvas logical units.
card_widthf64Card width in graph units.
card_min_heightf64Smallest card height in graph units.
label_bandf64Height reserved at the top of every card for a future prepared label.
port_rowf64Vertical spacing between port anchors in graph units.
port_sizef64Port anchor diameter in graph units.
border_widthf64Card border width in graph units.
radiusf64Card corner radius in graph units.
bendf64Minimum horizontal control offset of a connection curve, graph units.

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

structaster_blueprint::canvas::CanvasView

pub struct CanvasView { /* see fields */ }

The caller's explicit authoring view of the graph.

graph = (canvas / zoom) + pan, so pan is the graph-space point shown at the canvas logical origin and zoom is canvas logical units per graph unit.

Public fields

fieldtype
pan[f64; 2]Graph-space point shown at the canvas logical origin.
zoomf64Canvas logical units per graph unit. Finite and strictly positive.
size[f64; 2]Canvas logical viewport size in logical units.

Methods

  • fn new(pan: [f64; 2], zoom: f64, size: [f64; 2]) -> Self
  • fn graph_to_canvas(&self, point: [f64; 2]) -> [f64; 2] — Maps a graph-space point into canvas logical space.
  • fn canvas_to_graph(&self, point: [f64; 2]) -> [f64; 2] — Maps a canvas logical point back into graph space.

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

structaster_blueprint::canvas::NodeCard

pub struct NodeCard { /* see fields */ }

One drawn node card. The key is the authoring identity of the card and is unique per canvas.

Public fields

fieldtype
keymodel::NodeKey
definitionmodel::Symbol
graph_bounds[f64; 4]Graph-space bounds [x, y, w, h].
canvas_bounds[f64; 4]Canvas logical bounds [x, y, w, h].

Trait implementations: Clone, Debug, PartialEq, StructuralPartialEq

structaster_blueprint::canvas::NodePlacement

pub struct NodePlacement { /* see fields */ }

The caller's authoring position of one graph node, in graph space.

Positions are authoring-only. They are never written back into the [GraphSource] and they never change what the graph means.

Public fields

fieldtype
keymodel::NodeKey
position[f64; 2]Graph-space top-left corner of the node card.

Methods

  • fn new(key: NodeKey, position: [f64; 2]) -> Self

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

structaster_blueprint::canvas::PortAnchor

pub struct PortAnchor { /* see fields */ }

One port anchor on a card.

Public fields

fieldtype
nodemodel::NodeKey
portmodel::Symbol
kindPortKind
graph[f64; 2]Graph-space anchor point.
canvas[f64; 2]Canvas logical anchor point.

Trait implementations: Clone, Debug, PartialEq, StructuralPartialEq

structaster_blueprint::canvas::Wire

pub struct Wire { /* see fields */ }

One authored connection. Both endpoints come from the graph itself.

Public fields

fieldtype
frommodel::PortRefThe output port the connection starts at.
tomodel::PortRefThe input port the connection ends at.
curve[[f64; 2]; 4]Canvas logical curve points: start, first control, second control, end.

Trait implementations: Clone, Debug, PartialEq, StructuralPartialEq

Enums

enumaster_blueprint::canvas::CanvasError

pub enum CanvasError { InvalidLimits, InvalidStyle, InvalidView, InvalidZoom, InvalidPlacement, DuplicatePlacement, UnknownNode, NodeLimit, PortLimit, WireLimit, CommandLimit, GeometryOverflow, Recorder, Vector }

Refusal reasons. Every check runs before any command is recorded, so a refused canvas never produces a partial recording.

Variants

  • InvalidLimits — The limits themselves are not usable.
  • InvalidStyle — The style is not usable.
  • InvalidView — The view has a non-finite pan, size or zoom.
  • InvalidZoom — The zoom is not finite, not positive or outside the admitted band.
  • InvalidPlacement — A placement position is not finite.
  • DuplicatePlacement — The same node was placed twice.
  • UnknownNode — A placement names a node that is not part of this graph.
  • NodeLimit — More node cards than the admitted limit.
  • PortLimit — More port anchors than the admitted limit.
  • WireLimit — More connection lines than the admitted limit.
  • CommandLimit — More recording commands than the admitted limit.
  • GeometryOverflow — A coordinate left the admitted extent or stopped being finite.
  • Recorder — The Aster recorder refused a command.
  • Vector — The Aster vector source refused a geometry.

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

enumaster_blueprint::canvas::CanvasHit

pub enum CanvasHit { Node, Port, Pan }

The authoring target under a canvas point.

This is an authoring intent only. It never states that an application action is allowed, that a value is current or that anything is acknowledged.

Variants

  • Node — The body of a node card.
  • Port — A port anchor.
  • Pan — Empty canvas: the caller may pan.

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

enumaster_blueprint::canvas::PortKind

pub enum PortKind { Input, Output }

Which side of a card a port anchor belongs to.

Variants

  • Input
  • Output

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

Functions

fnaster_blueprint::canvas::build

pub fn build(graph: &model::GraphSource, view: CanvasView, placements: &[NodePlacement], style: &CanvasStyle, limits: &CanvasLimits) -> Result<Canvas, CanvasError>

Builds the authoring canvas of graph under the caller's view, node positions and style.

The graph is read only. Positions are authoring-only and are never written back into the graph. Every limit is checked before the first command is recorded, so a refusal never yields a partial recording.