quil_rs::quil

Trait Quil

Source
pub trait Quil: Debug {
    // Required method
    fn write(
        &self,
        writer: &mut impl Write,
        fall_back_to_debug: bool,
    ) -> Result<(), ToQuilError>;

    // Provided methods
    fn to_quil(&self) -> Result<String, ToQuilError> { ... }
    fn to_quil_or_debug(&self) -> String { ... }
}
Expand description

A trait to wrap items which represent some construct within the Quil language.

If you want to serialize an object to string and fail if it can’t be represented as valid Quil, then use to_quil(). If you want to serialize an object to string infallibly, and can tolerate invalid Quil, then use to_quil_or_debug().

Required Methods§

Source

fn write( &self, writer: &mut impl Write, fall_back_to_debug: bool, ) -> Result<(), ToQuilError>

Write the Quil representation of the item to the given writer. If fall_back_to_debug is true, then it must not return an error.

Provided Methods§

Source

fn to_quil(&self) -> Result<String, ToQuilError>

Return a string in valid Quil syntax or an error if the item cannot be represented with valid Quil.

Source

fn to_quil_or_debug(&self) -> String

Return a string in valid Quil syntax if possible. Any individual component of this object which cannot be represented in Quil will be replaced with a Debug representation of that component.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Quil for Expression

Source§

impl Quil for ArithmeticOperand

Source§

impl Quil for ArithmeticOperator

Source§

impl Quil for AttributeValue

Source§

impl Quil for BinaryOperand

Source§

impl Quil for BinaryOperator

Source§

impl Quil for ComparisonOperand

Source§

impl Quil for ComparisonOperator

Source§

impl Quil for ExternParameterType

Source§

impl Quil for GateModifier

Source§

impl Quil for GateSpecification

Source§

impl Quil for GateType

Source§

impl Quil for Instruction

Source§

impl Quil for PragmaArgument

Source§

impl Quil for Qubit

Source§

impl Quil for ScalarType

Source§

impl Quil for Target

Source§

impl Quil for UnaryOperator

Source§

impl Quil for UnresolvedCallArgument

Source§

impl Quil for Arithmetic

Source§

impl Quil for BinaryLogic

Source§

impl Quil for Calibration

Source§

impl Quil for CalibrationIdentifier

Source§

impl Quil for Call

Source§

impl Quil for Capture

Source§

impl Quil for CircuitDefinition

Source§

impl Quil for Comparison

Source§

impl Quil for Convert

Source§

impl Quil for Declaration

Source§

impl Quil for Delay

Source§

impl Quil for Exchange

Source§

impl Quil for ExternParameter

Source§

impl Quil for ExternSignature

Source§

impl Quil for Fence

Source§

impl Quil for FrameDefinition

Source§

impl Quil for FrameIdentifier

Source§

impl Quil for Gate

Source§

impl Quil for GateDefinition

Source§

impl Quil for Include

Source§

impl Quil for Jump

Source§

impl Quil for JumpUnless

Source§

impl Quil for JumpWhen

Source§

impl Quil for Label

Source§

impl Quil for Load

Source§

impl Quil for MeasureCalibrationDefinition

Source§

impl Quil for MeasureCalibrationIdentifier

Source§

impl Quil for Measurement

Source§

impl Quil for MemoryReference

Source§

impl Quil for Move

Source§

impl Quil for Offset

Source§

impl Quil for Pragma

Source§

impl Quil for Pulse

Source§

impl Quil for RawCapture

Source§

impl Quil for Reset

Source§

impl Quil for SetFrequency

Source§

impl Quil for SetPhase

Source§

impl Quil for SetScale

Source§

impl Quil for ShiftFrequency

Source§

impl Quil for ShiftPhase

Source§

impl Quil for Store

Source§

impl Quil for SwapPhases

Source§

impl Quil for UnaryLogic

Source§

impl Quil for Vector

Source§

impl Quil for WaveformDefinition

Source§

impl Quil for WaveformInvocation

Source§

impl Quil for Program