[][src]Struct dqcsim::host::simulation::Simulation

pub struct Simulation { /* fields omitted */ }

Simulation instance.

Implementations

impl Simulation[src]

pub fn new(
    pipeline: Pipeline,
    seed: Seed,
    reproduction_log: Option<Reproduction>,
    logger: &LogThread
) -> Result<Simulation>
[src]

Constructs a Simulation from a collection of PluginInstance and a random seed.

pub fn drop_plugins(&mut self)[src]

Drains the plugin pipeline so their drop() implementations get called.

pub fn accelerator(&self) -> &Box<dyn Plugin>[src]

pub fn accelerator_mut(&mut self) -> &mut Box<dyn Plugin>[src]

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

Yields to the accelerator.

The accelerator simulation runs until it blocks again. This is useful if you want an immediate response to an otherwise asynchronous call through the logging system or some communication channel outside of DQCsim's control.

This function silently returns immediately if no asynchronous data was pending or if the simulator is waiting for something that has not been sent yet.

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

Sends an ArbCmd message to one of the plugins, referenced by name.

ArbCmds are executed immediately after yielding to the simulator, so all pending asynchronous calls are flushed and executed before the ArbCmd.

pub fn arb_idx(
    &mut self,
    index: isize,
    cmd: impl Into<ArbCmd>
) -> Result<ArbData>
[src]

Sends an ArbCmd message to one of the plugins, referenced by index.

The frontend always has index 0. 1 through N are used for the operators in front to back order (where N is the number of operators). The backend is at index N+1.

Python-style negative indices are supported. That is, -1 can be used to refer to the backend, -2 to the last operator, and so on.

ArbCmds are executed immediately after yielding to the simulator, so all pending asynchronous calls are flushed and executed before the ArbCmd.

pub fn get_metadata(&self, name: impl AsRef<str>) -> Result<&PluginMetadata>[src]

Returns a reference to the metadata object belonging to the plugin referenced by instance name.

pub fn get_metadata_idx(&self, index: isize) -> Result<&PluginMetadata>[src]

Returns a reference to the metadata object belonging to the plugin referenced by index.

pub fn write_reproduction_file(&self, filename: impl AsRef<Path>) -> Result<()>[src]

Writes a the reproduction log to a file.

Trait Implementations

impl Accelerator for Simulation[src]

fn start(&mut self, args: impl Into<ArbData>) -> Result<()>[src]

Starts a program on the accelerator.

This is an asynchronous call: nothing happens until yield(), recv(), or wait() is called.

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

Waits for the accelerator to finish its current program.

When this succeeds, the return value of the accelerator's run() function is returned.

Deadlocks are detected and prevented by throwing an error message.

fn send(&mut self, args: impl Into<ArbData>) -> Result<()>[src]

Sends a message to the accelerator.

This is an asynchronous call: nothing happens until yield(), recv(), or wait() is called.

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

Waits for the accelerator to send a message to us.

Deadlocks are detected and prevented by throwing an error message.

impl Debug for Simulation[src]

impl Drop for Simulation[src]

Auto Trait Implementations

impl !RefUnwindSafe for Simulation

impl !Send for Simulation

impl !Sync for Simulation

impl Unpin for Simulation

impl !UnwindSafe for Simulation

Blanket Implementations

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

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

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

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<V, T> VZip<V> for T where
    V: MultiLane<T>,