Skip to main content

Document

Struct Document 

Source
pub struct Document {
    pub types: BTreeMap<String, Type>,
    pub workflows: Vec<Workflow>,
}

Fields§

§types: BTreeMap<String, Type>§workflows: Vec<Workflow>

Implementations§

Source§

impl Document

Source

pub fn from_script(text: &str, name: &str) -> Result<Document, String>

Reads a document a script builds. name appears in an error.

Source§

impl Document

Source

pub fn workflow(&self, name: &str) -> Option<&Workflow>

Source

pub fn resolve(&self, name: &str) -> Option<Type>

A type by name, whether declared or built in.

Source

pub fn parse(text: &str) -> Result<Document, String>

Reads a document, refusing anything it cannot apply exactly. A node that silently does nothing is worse than one that is refused, so every check names the workflow and node it failed at.

Source§

impl Document

Source

pub fn to_json(&self) -> String

The document as pma read it, with every default written out. A revision is stored in this form, so two revisions diff by what they mean rather than by how they were typed, and a document a script built reads like one a person wrote.

Source§

impl Document

Source

pub fn flatten(&self, workflow: &str) -> Result<Workflow, String>

The graph a pass walks: every call replaced by its callee’s nodes, prefixed with the call site. The runtime then holds one flat graph, one set of caps and one frontier, and workflow-level recursion cannot arise because there is nothing left to recurse through (W2).

Deterministic, so the edge indexes a move is keyed by are the same on every pass over one revision.

Source

pub fn unbuilt(&self) -> Vec<String>

Constructs a document may state and the runtime does not take yet. A revision holding any is refused at propose; check still costs it.

Source§

impl Document

Source

pub fn estimate( &self, workflow: &str, input_units: i64, agent_budget: f64, ) -> Result<Estimate, String>

The worst case, walked over the graph at every parameter’s declared maximum, so a bound never depends on what an invocation passed. input_units is the size of the argument bag.

Trait Implementations§

Source§

impl Clone for Document

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Document

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Document

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for Document

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Document

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.