[][src]Struct dqcsim::plugin::state::PluginState

pub struct PluginState<'a> { /* fields omitted */ }

Structure representing the state of a plugin.

This contains all state and connection information. The public members are exposed as user API calls.

Methods

impl<'a> PluginState<'a>[src]

pub fn run(
    definition: &'a PluginDefinition,
    simulator: impl Into<String>
) -> Result<()>
[src]

Executes a plugin described by definition within the context of the specified simulator endpoint address.

pub fn send(&mut self, msg: ArbData) -> Result<()>[src]

Sends a message to the host.

It is only legal to call this function from within the run() callback. Any other source will result in an Err return value.

pub fn recv(&mut self) -> Result<ArbData>[src]

Waits for a message from the host.

It is only legal to call this function from within the run() callback. Any other source will result in an Err return value.

pub fn allocate(
    &mut self,
    num_qubits: usize,
    commands: Vec<ArbCmd>
) -> Result<Vec<QubitRef>>
[src]

Allocate the given number of downstream qubits.

Backend plugins are not allowed to call this. Doing so will result in an Err return value.

pub fn free(&mut self, qubits: Vec<QubitRef>) -> Result<()>[src]

Free the given downstream qubits.

Backend plugins are not allowed to call this. Doing so will result in an Err return value.

pub fn gate(&mut self, gate: Gate) -> Result<()>[src]

Tells the downstream plugin to execute a gate.

Backend plugins are not allowed to call this. Doing so will result in an Err return value.

pub fn get_measurement(
    &mut self,
    qubit: QubitRef
) -> Result<QubitMeasurementResult>
[src]

Returns the latest measurement of the given downstream qubit.

Backend plugins are not allowed to call this. Doing so will result in an Err return value.

pub fn get_cycles_since_measure(&mut self, qubit: QubitRef) -> Result<u64>[src]

Returns the number of downstream cycles since the latest measurement of the given downstream qubit.

Backend plugins are not allowed to call this. Doing so will result in an Err return value.

pub fn get_cycles_between_measures(&mut self, qubit: QubitRef) -> Result<u64>[src]

Returns the number of downstream cycles between the last two measurements of the given downstream qubit.

Backend plugins are not allowed to call this. Doing so will result in an Err return value.

pub fn advance(&mut self, cycles: Cycles) -> Result<Cycle>[src]

Tells the downstream plugin to run for the specified number of cycles.

Backend plugins are not allowed to call this. Doing so will result in an Err return value.

pub fn get_cycle(&self) -> Result<Cycle>[src]

Returns the current value of the downstream cycle counter.

Backend plugins are not allowed to call this. Doing so will result in an Err return value.

pub fn arb(&mut self, cmd: ArbCmd) -> Result<ArbData>[src]

Sends an arbitrary command downstream.

Backend plugins are not allowed to call this. Doing so will result in an Err return value.

pub fn random_u64(&mut self) -> u64[src]

Generates a random unsigned 64-bit number using the simulator random seed.

This function may use one of two pseudorandom number generator states depending on whether it is called synchronized to the downstream command flow or synchronized to the upstream measurement flow (i.e. called by modify_measurements()). This is to ensure that the order in which the RNG functions are called per state does not depend on OS scheduling.

pub fn random_f64(&mut self) -> f64[src]

Generates a random floating point number using the simulator random seed.

The generated numbers are in the range [0,1>.

This function may use one of two pseudorandom number generator states depending on whether it is called synchronized to the downstream command flow or synchronized to the upstream measurement flow (i.e. called by modify_measurements()). This is to ensure that the order in which the RNG functions are called per state does not depend on OS scheduling.

Auto Trait Implementations

impl<'a> !Send for PluginState<'a>

impl<'a> Unpin for PluginState<'a>

impl<'a> !Sync for PluginState<'a>

impl<'a> !UnwindSafe for PluginState<'a>

impl<'a> !RefUnwindSafe for PluginState<'a>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,