Skip to main content

SheetTemplate

Struct SheetTemplate 

Source
pub struct SheetTemplate { /* private fields */ }
Expand description

Owns an immutable ordered graph recipe, independent of any live sheet.

Parameters alias bindings; private cells and methods are fresh per instance. Destruction releases last-owned inclusion edges iteratively; shared children and their factories remain alive until their last strong owner releases them.

§Examples

See the module example.

Implementations§

Source§

impl SheetTemplate

Source

pub fn instantiate( &self, destination: &mut Sheet, bindings: &[(&str, CellId)], ) -> Result<Instance, TemplateError>

Expands this recipe into destination, preserving bound-cell identities and values.

Binding, declared structure, expanded sizes, result reservation and empty specialized relationships are checked before mutation or factory calls, including relationships in inactive branches. A source output removes its entire method. Every authored method factory is checked against its declared edges/types before pruning or registration, even when that method writes a source. Out-cell arguments are unsupported. Later factory, allocation or native failures may leave partial structure; the destination remains safely discardable. Factories run only here, never at propagation.

§Errors

Returns binding errors for unknown, missing, repeated, aliased, invalid, out-kind, or wrongly typed actuals. Returns TemplateError::Construction for initializer, method, policy, relationship and empty-specialization failures, retaining the exact definition, authored site and actual inclusion chain. Its source preserves the original TemplateError::Factory, TemplateError::InvalidDefinition, TemplateError::Runtime or TemplateError::EmptyRelationship. Returns TemplateError::Capacity without a declaration site on checked-size overflow or failed reservation. A conditional construction failure returns TemplateError::ConditionalConstruction, retaining its definition, registration ordinal and actual root-to-child inclusion sites. Its source is the original TemplateError::ConditionalFactory, TemplateError::InvalidDefinition, TemplateError::Capacity or native construction error.

  • Complexity: Expected O(d + c + b + Σ(m² × e)) time and O(d + c + b + e + r + h) additional space for expanded declarations d, cells c, bindings b, relationships r, depth h, and each relationship’s m methods of at most e edges, excluding factory costs.
§Examples

See the module example.

Source

pub fn check_source_bindings( &self, bindings: &[(&str, bool)], ) -> Result<(), TemplateError>

Checks complete named formal source statuses without constructing a live sheet.

Uses the same whole-method pruning preflight as Self::instantiate. No initializer, method, policy, or conditional factory executes.

§Errors

Rejects missing, unknown or repeated names, capacity overflow, or a constituent relationship left without a method, including inactive branches.

  • Complexity: expected O(bc + w) time and O(k + h) space for b bindings, c root cells, and local checking work w across distinct (recipe, complete source mask) specializations. k counts specializations and their mask cells, and h is inclusion depth. Distinct masks can still grow exponentially.
§Examples
let mut builder = adam_rs::TemplateBuilder::new();
builder.parameter::<i32>("x")?;
builder.finish()?.check_source_bindings(&[("x", true)])?;
Source§

impl SheetTemplate

Source

pub fn parameter_names(&self) -> impl Iterator<Item = &str>

Borrows formal names in declaration order, excluding private cells.

  • Complexity: O(c) traversal for c local declarations.
§Examples
let mut builder = adam_rs::TemplateBuilder::new();
builder.parameter::<i32>("value")?;
assert_eq!(builder.finish()?.parameter_names().collect::<Vec<_>>(), ["value"]);
Source

pub fn id(&self) -> TemplateId

Returns this recipe’s immutable identity without retaining its factories or children.

§Examples
let template = adam_rs::TemplateBuilder::new().finish()?;
assert_eq!(template.id(), template.id());
Source§

impl SheetTemplate

Source

pub fn is_relationship_only(&self) -> bool

Returns whether expansion contains only relationships and parameter declarations.

Private cells, policies, outputs and conditionals disqualify a recipe transitively. An empty recipe qualifies, independently of source specialization.

§Examples
assert!(TemplateBuilder::new().finish()?.is_relationship_only());

Trait Implementations§

Source§

impl Drop for SheetTemplate

Source§

fn drop(&mut self)

Releases uniquely owned inclusion descendants without recursive destruction.

Shared children retain their recipes unchanged. Detaching a uniquely owned child’s edges before dropping it bounds destructor call depth independently of inclusion nesting.

  • Complexity: O(n) time for released recipe storage n, excluding captured-value destructors; O(w) additional space for the maximum pending relationship edges w.
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.