This repository was archived by the owner on Jun 20, 2022. It is now read-only.
Description This proposal is work-in-progress.
To enable ergonomic development of plugins with Rust, we should add some feature-gated APIs with common methods and structures.
My proposal:
Add a plugin feature which is not part of the default features. Plugins can then depend on dqcsim like this:
[dependencies ]
dqcsim = { version = " .." , default-features = false , features = [" plugin" ] }
Move the dqcsim::common::gates module behind the plugin feature-gate.
Add FrontEnd//Backend/Operator traits:
trait FrontEnd {
fn run ( & self )
fn initialize ( & self ) -> { .. }
fn host ( & self ) -> { .. }
}
Add a (procedural macro) to derive a PluginDefinition (PluginType and PluginMetadata) for a struct. Also allow deriving the plugin arguments (opts).
#[ derive( FrontEnd ) ]
#[ dqcsim( name="front-end" , author = "me" , version = "0.1.0" ) ]
struct MyPlugin {
//#[dqcsim(opt="input.file")]
input : PathBuf ,
}
#[ derive( DqcsimOpt ) ]
struct MyPluginOpt {
}
impl TryFrom < Vec < ArbCmd > > for MyPluginOpt { }
impl MyPlugin {
#[ dqcsim( run) ]
fn run ( & self , opt ) {
let opt: MyPluginOpt = opt. try_from ( ) ?;
}
}
//
impl FrontEnd for MyPlugin {
fn run ( & self ) -> {
MyPlugin :: run ( self )
}
} Reactions are currently unavailable
This proposal is work-in-progress.
To enable ergonomic development of plugins with Rust, we should add some feature-gated APIs with common methods and structures.
My proposal:
pluginfeature which is not part of the default features. Plugins can then depend ondqcsimlike this:dqcsim::common::gatesmodule behind thepluginfeature-gate.FrontEnd//Backend/Operatortraits:PluginDefinition(PluginTypeandPluginMetadata) for a struct. Also allow deriving the plugin arguments (opts).