[−][src]Struct dqcsim::plugin::definition::PluginDefinition
Defines a plugin.
This struct is constructed by the user (or the foreign language API). The behavior of the plugin is defined by a number of closures that the user must provide. For more information about the callback functions, refer to the documentation of the foreign language API setter functions.
Fields
initialize: Box<dyn Fn(&mut PluginState<'_>, Vec<ArbCmd>) -> Result<()> + Send + 'static>
Initialization callback.
drop: Box<dyn Fn(&mut PluginState<'_>) -> Result<()> + Send + 'static>
Finalization callback.
run: Box<dyn Fn(&mut PluginState<'_>, ArbData) -> Result<ArbData> + Send + 'static>
Run callback for frontends.
allocate: Box<dyn Fn(&mut PluginState<'_>, Vec<QubitRef>, Vec<ArbCmd>) -> Result<()> + Send + 'static>
Qubit allocation callback for operators and backends.
free: Box<dyn Fn(&mut PluginState<'_>, Vec<QubitRef>) -> Result<()> + Send + 'static>
Qubit deallocation callback for operators and backends.
gate: Box<dyn Fn(&mut PluginState<'_>, Gate) -> Result<Vec<QubitMeasurementResult>> + Send + 'static>
Gate execution callback for operators and backends.
modify_measurement: Box<dyn Fn(&mut PluginState<'_>, QubitMeasurementResult) -> Result<Vec<QubitMeasurementResult>> + Send + 'static>
Measurement modification callback for operators.
advance: Box<dyn Fn(&mut PluginState<'_>, u64) -> Result<()> + Send + 'static>
Callback for advancing time for operators and backends.
upstream_arb: Box<dyn Fn(&mut PluginState<'_>, ArbCmd) -> Result<ArbData> + Send + 'static>
Callback function for handling an arb from upstream for operators and backends.
host_arb: Box<dyn Fn(&mut PluginState<'_>, ArbCmd) -> Result<ArbData> + Send + 'static>
Callback function for handling an arb from the host.
Implementations
impl PluginDefinition
[src]
pub fn new(
typ: PluginType,
metadata: impl Into<PluginMetadata>
) -> PluginDefinition
[src]
typ: PluginType,
metadata: impl Into<PluginMetadata>
) -> PluginDefinition
Constructs a new plugin definition with default callbacks.
The callbacks can be overridden by modifying the boxed callback fields directly.
pub fn get_type(&self) -> PluginType
[src]
Returns the plugin type.
pub fn set_type(&mut self, typ: PluginType)
[src]
Sets the type of the plugin.
pub fn get_metadata(&self) -> &PluginMetadata
[src]
Returns the plugin metadata.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for PluginDefinition
impl Send for PluginDefinition
impl !Sync for PluginDefinition
impl Unpin for PluginDefinition
impl !UnwindSafe for PluginDefinition
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,