API reference

aster_blueprint::workspace

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.

Bounded authoring-workspace envelope for an authored blueprint asset.

This module persists authoring state only: the existing graph-document bytes produced by [crate::codec::encode_bounded] plus editor-only node positions and an optional selected node. It never serializes or reconstructs a SourceStamp, a PlanId, a scene/input snapshot or any backend authority. Decoding yields a candidate graph and positions; admission to an editor is the caller's job through the existing Editor::open compile step. This module therefore performs no compilation, no backend admission and no filesystem or service access.

The envelope is deliberately small and fully bounded: a magic, a version, a graph byte length, the graph document, a node-position count, the position entries and a selection flag. Total byte and position-count limits are checked before the corresponding copies and allocations, and malformed lengths, unsupported versions, non-finite or duplicate/unknown-node positions, unknown selections and trailing junk are refused.

Structs

structaster_blueprint::workspace::Position

pub struct Position { /* see fields */ }

One finite editor-only position. Positions are never compiled.

Public fields

fieldtype
xf64
yf64

Methods

  • fn new(x: f64, y: f64) -> Self
  • fn is_finite(self) -> bool — A position is admissible only when both coordinates are finite.

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

structaster_blueprint::workspace::Workspace

pub struct Workspace { /* see fields */ }

A decoded candidate: a freshly identified graph document plus authoring-only positions and selection. This is not an admitted editor state; the caller must compile it through the existing editor before adopting it.

Methods

  • fn graph(&self) -> &GraphSource
  • fn into_graph(self) -> GraphSource — Take the candidate graph, carrying a fresh process-local stamp.
  • fn positions(&self) -> &BTreeMap<NodeKey, Position>
  • fn selection(&self) -> Option<NodeKey>

Trait implementations: Debug

structaster_blueprint::workspace::WorkspaceLimits

pub struct WorkspaceLimits { /* see fields */ }

Bounds for one workspace envelope. total_bytes bounds the whole envelope; positions bounds the number of authored node positions; graph bounds the embedded graph document independently.

Public fields

fieldtype
total_bytesusize
positionsusize
graphcodec::DecodeLimits

Trait implementations: Clone, Copy, Debug, Default

Enums

enumaster_blueprint::workspace::WorkspaceError

pub enum WorkspaceError { Capacity, Allocation, Version, Truncated, Malformed, NonFinitePosition, DuplicatePosition, UnknownNode, UnknownSelection, Graph }

A refused workspace operation. Graph-document failures are carried whole.

Variants

  • Capacity — The envelope, its position count or a length prefix exceeds a limit.
  • Allocation — A bounded encoder allocation could not be reserved.
  • Version — The envelope version is not [WORKSPACE_VERSION].
  • Truncated — The byte stream ends before a declared field is complete.
  • Malformed — A length prefix or the envelope layout is internally inconsistent.
  • NonFinitePosition — A position coordinate is not finite.
  • DuplicatePosition — The same node key appears in more than one position entry.
  • UnknownNode — A position names a node that is not in the graph document.
  • UnknownSelection — The selection names a node that is not in the graph document.
  • Graph — The embedded graph document was refused by the existing codec.

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

Functions

fnaster_blueprint::workspace::decode

pub fn decode(bytes: &[u8], limits: WorkspaceLimits) -> Result<Workspace, WorkspaceError>

Decode a candidate workspace. The whole envelope size is checked before any copy, and the position count and its byte span are checked before the positions map is allocated. The graph document is decoded by the existing codec with its own limits. No compilation or admission happens here.

fnaster_blueprint::workspace::encode

pub fn encode(graph: &model::GraphSource, positions: &std::collections::BTreeMap<model::NodeKey, Position>, selection: Option<model::NodeKey>, limits: WorkspaceLimits) -> Result<Vec<u8>, WorkspaceError>

Encode an authored workspace. The graph document is produced by the existing codec; only the graph bytes, positions and selection are written. Limits, finiteness and node membership are all checked before the output buffer is allocated.

Constants

constaster_blueprint::workspace::WORKSPACE_VERSION

pub const WORKSPACE_VERSION: u16

Envelope format version. Independent of the graph document version.