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
sourceimpl Program
impl Program
sourcepub fn type_check(&self) -> Result<(), Vec<TypeError>>
pub fn type_check(&self) -> Result<(), Vec<TypeError>>
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.
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Program
impl<'de> Deserialize<'de> for Program
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<'a, D: DocAllocator<'a>> Pretty<'a, D, ()> for Program
impl<'a, D: DocAllocator<'a>> Pretty<'a, D, ()> for Program
sourcefn pretty(self, alloc: &'a D) -> DocBuilder<'a, D>
fn pretty(self, alloc: &'a D) -> DocBuilder<'a, D>
Converts self into a document
Auto Trait Implementations
impl RefUnwindSafe for Program
impl !Send for Program
impl !Sync for Program
impl Unpin for Program
impl UnwindSafe for Program
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more