pub struct Program {
pub settings: Option<Settings>,
pub global_variables: Vec<Variable>,
pub player_variables: Vec<Variable>,
pub subroutines: Vec<Subroutine>,
pub rules: Vec<Rule>,
/* private fields */
}Expand description
A complete Workshop program built from Workshop concepts.
Fields§
§settings: Option<Settings>§global_variables: Vec<Variable>§player_variables: Vec<Variable>§subroutines: Vec<Subroutine>§rules: Vec<Rule>Implementations§
Source§impl Program
impl Program
Sourcepub fn element_count(
&self,
catalog: &Catalog,
) -> Result<ElementCountReport, ElementCountError>
pub fn element_count( &self, catalog: &Catalog, ) -> Result<ElementCountReport, ElementCountError>
Count the canonical Workshop target represented by this program.
Source§impl Program
impl Program
pub fn new() -> Self
pub fn global_variable(&mut self, variable: Variable) -> &mut Self
pub fn player_variable(&mut self, variable: Variable) -> &mut Self
pub fn subroutine(&mut self, subroutine: Subroutine) -> &mut Self
pub fn rule(&mut self, rule: Rule) -> &mut Self
Sourcepub fn source(&self, file: FileId) -> Option<&SourceDocument>
pub fn source(&self, file: FileId) -> Option<&SourceDocument>
Return the retained source document for a parsed file.
Sourcepub fn rule_span(&self, rule: usize) -> Option<Span>
pub fn rule_span(&self, rule: usize) -> Option<Span>
Return the authored span of a public rule, when source metadata exists.
Sourcepub fn condition_span(&self, rule: usize, condition: usize) -> Option<Span>
pub fn condition_span(&self, rule: usize, condition: usize) -> Option<Span>
Return the authored span of a public rule condition value.
Sourcepub fn action_span(&self, rule: usize, action: usize) -> Option<Span>
pub fn action_span(&self, rule: usize, action: usize) -> Option<Span>
Return the authored span of a public action in its linear rule order.
Sourcepub fn action_argument_span(
&self,
rule: usize,
action: usize,
argument: usize,
) -> Option<Span>
pub fn action_argument_span( &self, rule: usize, action: usize, argument: usize, ) -> Option<Span>
Return the authored span of a direct value argument of a public action.
Sourcepub fn edit_source(
&self,
span: Span,
replacement: impl Into<String>,
) -> Result<SourceEdit, SourceEditError>
pub fn edit_source( &self, span: Span, replacement: impl Into<String>, ) -> Result<SourceEdit, SourceEditError>
Create a checked source edit through the authored source attached to this canonical program.
Sourcepub fn validate(&self) -> Result<(), WorkshopError>
pub fn validate(&self) -> Result<(), WorkshopError>
Validate the structural invariants of the canonical program.
Sourcepub fn semantic_issues(&self, catalog: &Catalog) -> Vec<SemanticIssue>
pub fn semantic_issues(&self, catalog: &Catalog) -> Vec<SemanticIssue>
Report constructs that are structurally preserved but not fully understood by the canonical catalog.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Program
impl RefUnwindSafe for Program
impl Send for Program
impl Sync for Program
impl Unpin for Program
impl UnsafeUnpin for Program
impl UnwindSafe for Program
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more