pub struct Program {
    pub decls: Vec<Span<Decl>>,
}
Expand description

Represents a whole program with defintions and statements. The definitions and declarations may cover more than one file.

Fields

decls: Vec<Span<Decl>>

The declarations in this program.

Implementations

Type-check this whole program.

This will check the program for some of the following errors:

  • Undefined gates, registers, or parameters,
  • Overlapping or invalid definitions or names,
  • Mismatched types and sizes in statements,
  • Recursive gate definitions.

Notably, this does not check that arguments to gates are distinct, nor that parameters are valid (e.g free from divide-by-zero), as it does not do any evaluation. Therefore, some more errors may occur during interpretation, even if no errors are reported here.

This is supported on crate feature pretty only.

Pretty-print this object to a string. For more fine-grained control, use the pretty::Pretty trait from the pretty crate directly.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Converts self into a document

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.