Struct quil::program::PyProgram

source ·
pub struct PyProgram(/* private fields */);

Implementations§

source§

impl PyProgram

source

pub fn __repr__(&self) -> String

source§

impl PyProgram

source

pub fn parse(input: &str) -> PyResult<Self>

source§

impl PyProgram

source

pub fn to_quil(&self) -> PyResult<String>

source

pub fn to_quil_or_debug(&self) -> String

source§

impl PyProgram

source

pub fn __richcmp__( &self, py: Python<'_>, other: &Self, op: CompareOp ) -> PyObject

source§

impl PyProgram

source

pub fn new() -> Self

source

pub fn clone_without_body_instructions(&self) -> Self

source

pub fn copy(&self) -> Self

source

pub fn body_instructions<'a>(&self, py: Python<'a>) -> PyResult<&'a PyList>

source

pub fn calibrations(&self, py: Python<'_>) -> PyResult<PyCalibrationSet>

source

pub fn set_calibrations( &mut self, py: Python<'_>, calibrations: PyCalibrationSet ) -> PyResult<()>

source

pub fn waveforms( &self, py: Python<'_> ) -> PyResult<BTreeMap<String, PyWaveform>>

source

pub fn set_waveforms( &mut self, py: Python<'_>, waveforms: BTreeMap<String, PyWaveform> ) -> PyResult<()>

source

pub fn frames(&self, py: Python<'_>) -> PyResult<PyFrameSet>

source

pub fn set_frames(&mut self, py: Python<'_>, frames: PyFrameSet) -> PyResult<()>

source

pub fn memory_regions( &self, py: Python<'_> ) -> PyResult<BTreeMap<String, PyMemoryRegion>>

source

pub fn set_memory_regions( &mut self, py: Python<'_>, memory_regions: BTreeMap<String, PyMemoryRegion> ) -> PyResult<()>

source

pub fn declarations( &self, py: Python<'_> ) -> PyResult<HashMap<String, PyDeclaration>>

source

pub fn gate_definitions( &self, py: Python<'_> ) -> PyResult<BTreeMap<String, PyGateDefinition>>

source

pub fn set_gate_definitions( &mut self, definitions: BTreeMap<String, PyGateDefinition> )

source

pub fn dagger(&self) -> PyResult<Self>

source

pub fn expand_calibrations(&self) -> PyResult<Self>

source

pub fn into_simplified(&self) -> PyResult<Self>

source

pub fn get_used_qubits(&self, py: Python<'_>) -> PyResult<HashSet<PyQubit>>

source

pub fn add_instruction(&mut self, instruction: PyInstruction)

source

pub fn add_instructions(&mut self, instructions: Vec<PyInstruction>)

source

pub fn to_instructions(&self, py: Python<'_>) -> PyResult<Vec<PyInstruction>>

source

pub fn to_unitary( &self, py: Python<'_>, n_qubits: u64 ) -> PyResult<Py<PyArray2<Complex64>>>

source

pub fn filter_instructions( &self, py: Python<'_>, predicate: Py<PyFunction> ) -> PyResult<Self>

source

pub fn resolve_placeholders(&mut self)

source

pub fn wrap_in_loop( &self, loop_count_reference: PyMemoryReference, start_target: PyTarget, end_target: PyTarget, iterations: u32 ) -> Self

source

pub fn resolve_placeholders_with_custom_resolvers( &mut self, target_resolver: Option<Py<PyFunction>>, qubit_resolver: Option<Py<PyFunction>> )

source

pub fn __add__(&self, py: Python<'_>, rhs: Self) -> PyResult<Self>

source

pub fn __iadd__(&mut self, rhs: Self)

source

pub fn __getstate__(&self, py: Python<'_>) -> PyResult<Py<PyBytes>>

source

pub fn __setstate__(&mut self, py: Python<'_>, state: &PyBytes) -> PyResult<()>

Trait Implementations§

source§

impl AsMut<<PyProgram as PyWrapper>::Inner> for PyProgram

source§

fn as_mut(&mut self) -> &mut <PyProgram as PyWrapper>::Inner

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsRef<Program> for PyProgram

source§

fn as_ref(&self) -> &Program

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for PyProgram

source§

fn clone(&self) -> PyProgram

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for PyProgram

source§

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

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

impl Default for PyProgram

source§

fn default() -> Self

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

impl From<&Program> for PyProgram

source§

fn from(inner: &Program) -> Self

Converts to this type from the input type.
source§

impl From<Program> for PyProgram

source§

fn from(inner: Program) -> Self

Converts to this type from the input type.
source§

impl From<PyProgram> for Program

source§

fn from(wrapper: PyProgram) -> Self

Converts to this type from the input type.
source§

impl FromStr for PyProgram

§

type Err = ProgramError

The associated error which can be returned from parsing.
source§

fn from_str(input: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl IntoPy<Py<PyAny>> for PyProgram

source§

fn into_py(self, py: Python<'_>) -> PyObject

Performs the conversion.
source§

impl PartialEq for PyProgram

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PyClass for PyProgram

§

type Frozen = False

Whether the pyclass is frozen. Read more
source§

impl PyClassImpl for PyProgram

source§

const IS_BASETYPE: bool = false

#[pyclass(subclass)]
source§

const IS_SUBCLASS: bool = false

#[pyclass(extends=…)]
source§

const IS_MAPPING: bool = false

#[pyclass(mapping)]
source§

const IS_SEQUENCE: bool = false

#[pyclass(sequence)]
§

type BaseType = PyAny

Base class
§

type ThreadChecker = SendablePyClass<PyProgram>

This handles following two situations: Read more
§

type Inventory = Pyo3MethodsInventoryForPyProgram

§

type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild

Immutable or mutable
§

type Dict = PyClassDummySlot

Specify this class has #[pyclass(dict)] or not.
§

type WeakRef = PyClassDummySlot

Specify this class has #[pyclass(weakref)] or not.
§

type BaseNativeType = PyAny

The closest native ancestor. This is PyAny by default, and when you declare #[pyclass(extends=PyDict)], it’s PyDict.
source§

fn items_iter() -> PyClassItemsIter

source§

fn doc(py: Python<'_>) -> PyResult<&'static CStr>

Rendered class doc
source§

fn lazy_type_object() -> &'static LazyTypeObject<Self>

source§

fn dict_offset() -> Option<isize>

source§

fn weaklist_offset() -> Option<isize>

source§

impl PyClassNewTextSignature<PyProgram> for PyClassImplCollector<PyProgram>

source§

fn new_text_signature(self) -> Option<&'static str>

source§

impl PyClass__add__SlotFragment<PyProgram> for PyClassImplCollector<PyProgram>

source§

unsafe fn __add__( self, py: Python<'_>, _raw_slf: *mut PyObject, arg0: *mut PyObject ) -> PyResult<*mut PyObject>

Safety: _slf and _other must be valid non-null Python objects Read more
source§

impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a PyProgram

§

type Holder = Option<PyRef<'py, PyProgram>>

source§

fn extract(obj: &'py PyAny, holder: &'a mut Self::Holder) -> PyResult<Self>

source§

impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut PyProgram

§

type Holder = Option<PyRefMut<'py, PyProgram>>

source§

fn extract(obj: &'py PyAny, holder: &'a mut Self::Holder) -> PyResult<Self>

source§

impl PyTryFrom<PyAny> for PyProgram

source§

fn py_try_from(py: Python<'_>, item: &PyAny) -> PyResult<Self>

Convert from a Py<T>. Defaults to delegating to py_from_ref. Read more
source§

impl PyTryFrom<PyProgram> for Program

source§

fn py_try_from(py: Python<'_>, item: &PyProgram) -> PyResult<Self>

Convert from a Py<T>. Defaults to delegating to py_from_ref. Read more
source§

impl PyTryFrom<PyProgram> for PyProgram

source§

fn py_try_from(py: Python<'_>, item: &PyProgram) -> PyResult<Self>

Convert from a Py<T>. Defaults to delegating to py_from_ref. Read more
source§

impl PyTypeInfo for PyProgram

§

type AsRefTarget = PyCell<PyProgram>

Utility type to make Py::as_ref work.
source§

const NAME: &'static str = "Program"

Class name.
source§

const MODULE: Option<&'static str> = _

Module name, if any.
source§

fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject

Returns the PyTypeObject instance for this type.
source§

fn type_object(py: Python<'_>) -> &PyType

Returns the safe abstraction over the type object.
source§

fn is_type_of(object: &PyAny) -> bool

Checks if object is an instance of this type or a subclass of this type.
source§

fn is_exact_type_of(object: &PyAny) -> bool

Checks if object is an instance of this type.
source§

impl PyWrapper for PyProgram

§

type Inner = Program

The Rust type being wrapped.
source§

fn as_inner(&self) -> &Self::Inner

Returns a reference to the inner item. Read more
source§

fn into_inner(self) -> Self::Inner

Converts this into the inner item. Read more
source§

impl ToPyObject for PyProgram

source§

fn to_object(&self, py: Python<'_>) -> PyObject

Converts self into a Python object.
source§

impl<'a> ToPython<Py<PyAny>> for &'a PyProgram

source§

fn to_python(&self, py: Python<'_>) -> PyResult<Py<PyAny>>

Convert from Rust self into a Python type. Read more
source§

impl ToPython<Py<PyAny>> for PyProgram

source§

fn to_python(&self, py: Python<'_>) -> PyResult<Py<PyAny>>

Convert from Rust self into a Python type. Read more
source§

impl<'a> ToPython<PyProgram> for &'a Program

source§

fn to_python(&self, py: Python<'_>) -> PyResult<PyProgram>

Convert from Rust self into a Python type. Read more
source§

impl ToPython<PyProgram> for Program

source§

fn to_python(&self, py: Python<'_>) -> PyResult<PyProgram>

Convert from Rust self into a Python type. Read more
source§

impl StructuralPartialEq for PyProgram

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<'a, T> FromPyObject<'a> for T
where T: PyClass + Clone,

source§

fn extract(obj: &'a PyAny) -> Result<T, PyErr>

Extracts Self from the source PyObject.
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> PyErrArguments for T
where T: IntoPy<Py<PyAny>> + Send + Sync,

source§

fn arguments(self, py: Python<'_>) -> Py<PyAny>

Arguments for exception
source§

impl<T> PyWrapperMut for T
where T: PyWrapper + AsMut<<T as PyWrapper>::Inner>,

source§

fn as_inner_mut(&mut self) -> &mut Self::Inner

Returns a mutable reference to the inner item. Read more
source§

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

§

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>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.
source§

impl<T> Ungil for T
where T: Send,