-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9499964
commit 3d52334
Showing
1 changed file
with
2 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,3 @@ | ||
use stblib::external::plugin::{Plugin, PluginProperties}; | ||
|
||
pub struct ExamplePlugin; | ||
|
||
impl Plugin for ExamplePlugin { | ||
fn execute(&self, args: &[String]) { | ||
match args.first().unwrap().as_str() { | ||
"test" => { | ||
println!("Example plugin") | ||
}, | ||
"foo" => { | ||
println!("Bar!") | ||
} | ||
_ => self.help() | ||
} | ||
} | ||
|
||
fn help(&self) { | ||
println!("Example help message") | ||
} | ||
} | ||
|
||
#[allow(improper_ctypes_definitions)] | ||
#[no_mangle] | ||
pub extern "C" fn create_plugin() -> (Box<dyn Plugin>, PluginProperties) { | ||
let properties: PluginProperties = PluginProperties { | ||
name: "Example Plugin", | ||
id: "example-plugin", | ||
package_id: "com.example.exampleplugin", | ||
version: env!("CARGO_PKG_VERSION"), | ||
library_version: stblib::VERSION, | ||
}; | ||
|
||
(Box::new(ExamplePlugin), properties) | ||
pub fn plugin() { | ||
|
||
} |