#[non_exhaustive]pub struct Operation<P = String> {
pub op_type: OpType,
pub n_qb: Option<u32>,
pub data: Option<String>,
pub params: Option<Vec<P>>,
pub op_box: Option<OpBox>,
pub classical_expr: Option<ClExpr>,
pub signature: Option<Vec<String>>,
pub conditional: Option<Conditional>,
pub classical: Option<Box<Classical>>,
pub wasm: Option<Box<Wasm>>,
}
Expand description
Serializable operation descriptor.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.op_type: OpType
The type of operation.
n_qb: Option<u32>
Number of input and output qubits.
data: Option<String>
Additional string stored in the op
params: Option<Vec<P>>
Expressions for the parameters of the operation.
op_box: Option<OpBox>
Internal box for the operation.
classical_expr: Option<ClExpr>
Classical expression.
Required if the operation is of type OpType::ClExpr
.
signature: Option<Vec<String>>
The pre-computed signature.
conditional: Option<Conditional>
A QASM-style classical condition for the operation.
classical: Option<Box<Classical>>
Data for commands which only act on Bits classically.
wasm: Option<Box<Wasm>>
Data for commands which apply WASM operations.
Implementations§
Source§impl<P> Operation<P>
impl<P> Operation<P>
Sourcepub fn from_optype(op_type: OpType) -> Self
pub fn from_optype(op_type: OpType) -> Self
Returns a default-initialized Operation with the given type.
For optypes that require additional parameters, this may generate invalid operations.
Sourcepub fn map_params<Q>(self, f: impl FnMut(P) -> Q) -> Operation<Q>
pub fn map_params<Q>(self, f: impl FnMut(P) -> Q) -> Operation<Q>
Applies a function over the parameters of the operation.
Returns a new Operation with the same data, but with a new generic type for the parameters.
Trait Implementations§
Source§impl<'de, P> Deserialize<'de> for Operation<P>where
P: Deserialize<'de>,
impl<'de, P> Deserialize<'de> for Operation<P>where
P: Deserialize<'de>,
Source§fn 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
impl<P> StructuralPartialEq for Operation<P>
Auto Trait Implementations§
impl<P> Freeze for Operation<P>
impl<P> RefUnwindSafe for Operation<P>where
P: RefUnwindSafe,
impl<P> Send for Operation<P>where
P: Send,
impl<P> Sync for Operation<P>where
P: Sync,
impl<P> Unpin for Operation<P>where
P: Unpin,
impl<P> UnwindSafe for Operation<P>where
P: UnwindSafe,
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