SimulatorToPlugin

Enum SimulatorToPlugin 

Source
pub enum SimulatorToPlugin {
    Initialize(Box<PluginInitializeRequest>),
    AcceptUpstream,
    UserInitialize(PluginUserInitializeRequest),
    Abort,
    RunRequest(FrontendRunRequest),
    ArbRequest(ArbCmd),
}
Expand description

Simulator/host to plugin requests.

Variants§

§

Initialize(Box<PluginInitializeRequest>)

Request to initialize the plugin.

This is always the first message sent by DQCsim. In response, the plugin must:

  • initialize its logging facilities (note that the tee files provided by the copy of the plugin configuration are to be handled by the plugin);
  • verify with the user code that the plugin implementation is of the expected type (frontend, operator, or backend);
  • connect to the downstream plugin if the plugin is not a backend;
  • initialize an IPC endpoint for the upstream plugin to connect to if the plugin is not a frontend;
  • return the aforementioned URI to the simulator through a PluginToSimulator::Initialized message.

The valid responses to this message are:

  • success: PluginToSimulator::Initialized
  • failure: PluginToSimulator::Failure
§

AcceptUpstream

Request to complete the connection with the upstream plugin.

This is always the second message sent by DQCsim for operators and backends. It is called after the upstream plugin has been successfully initialized. In response, the plugin must wait for the upstream plugin to connect and finish setting up the connection.

The valid responses to this message are:

  • success: PluginToSimulator::Success
  • failure: PluginToSimulator::Failure
§

UserInitialize(PluginUserInitializeRequest)

Request to run user initialization code.

This is always the second (frontend) or third (operator, backend) message sent by DQCsim.

The valid responses to this message are:

  • success: PluginToSimulator::Success
  • failure: PluginToSimulator::Failure
§

Abort

Request to abort the simulation and stop the plugin.

The valid responses to this message are:

  • success: PluginToSimulator::Success
  • failure: PluginToSimulator::Failure
§

RunRequest(FrontendRunRequest)

Passes control from the host to the frontend plugin.

This is only to be sent to frontends. In response, the frontend must:

  • queue up any enclosed messages for reception through the plugin’s recv() function;
  • if start is specified, call the user’s implementation of the run() callback (if this message was received while already executing run(), return an error instead);
  • if the user’s implementation of run() terminates, put its return value in the result field of the response;
  • if the user’s implementation of run() queued up messages through send(), put them into the messages field of the response;
  • send the PluginToSimulator::RunResponse message in response.

The valid responses to this message are:

  • success: PluginToSimulator::RunResponse
  • failure: PluginToSimulator::Failure
§

ArbRequest(ArbCmd)

Requests execution of the given ArbCmd by the plugin.

The valid responses to this message are:

  • success: PluginToSimulator::ArbResponse
  • failure: PluginToSimulator::Failure

Trait Implementations§

Source§

impl Debug for SimulatorToPlugin

Source§

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

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

impl<'de> Deserialize<'de> for SimulatorToPlugin

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Into<SimulatorToPlugin> for ArbCmd

Source§

fn into(self) -> SimulatorToPlugin

Converts this type into the (usually inferred) input type.
Source§

impl Into<SimulatorToPlugin> for FrontendRunRequest

Source§

fn into(self) -> SimulatorToPlugin

Converts this type into the (usually inferred) input type.
Source§

impl Into<SimulatorToPlugin> for PluginAcceptUpstreamRequest

Source§

fn into(self) -> SimulatorToPlugin

Converts this type into the (usually inferred) input type.
Source§

impl Into<SimulatorToPlugin> for PluginInitializeRequest

Source§

fn into(self) -> SimulatorToPlugin

Converts this type into the (usually inferred) input type.
Source§

impl Into<SimulatorToPlugin> for PluginUserInitializeRequest

Source§

fn into(self) -> SimulatorToPlugin

Converts this type into the (usually inferred) input type.
Source§

impl PartialEq for SimulatorToPlugin

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for SimulatorToPlugin

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for SimulatorToPlugin

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<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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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

Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,