feat: expanding ewwii_plugin_api
This commit is contained in:
@@ -8,8 +8,21 @@ pub(crate) struct EwwiiImpl {
|
||||
|
||||
impl EwwiiAPI for EwwiiImpl {
|
||||
// General
|
||||
// "PCL = Plugin Controlled Log"
|
||||
fn print(&self, msg: &str) {
|
||||
println!("[PCL] {}", msg);
|
||||
}
|
||||
|
||||
fn log(&self, msg: &str) {
|
||||
println!("[HOST LOG] {}", msg);
|
||||
log::info!("[PCL] {}", msg);
|
||||
}
|
||||
|
||||
fn warn(&self, msg: &str) {
|
||||
log::warn!("[PCL] {}", msg);
|
||||
}
|
||||
|
||||
fn error(&self, msg: &str) {
|
||||
log::error!("[PCL] {}", msg);
|
||||
}
|
||||
|
||||
// Rhai Manipulation Stuff
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "ewwii_plugin_api"
|
||||
version = "0.1.1"
|
||||
version = "0.2.0"
|
||||
authors = ["byson94 <byson94wastaken@gmail.com>"]
|
||||
edition = "2021"
|
||||
license = "GPL-3.0-or-later"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//! It allows fast and easy export of plugins by abstracting
|
||||
//! the FFI (Foreign Function Interface) related code needed.
|
||||
|
||||
/// Automatically implements `create_plugin` for a given fieldless structure
|
||||
/// Automatically implements `create_plugin` for a given fieldless structure
|
||||
#[macro_export]
|
||||
macro_rules! export_plugin {
|
||||
($plugin_struct:ty) => {
|
||||
|
||||
@@ -33,7 +33,13 @@ use rhai::Engine;
|
||||
pub trait EwwiiAPI: Send + Sync {
|
||||
// == General Stuff == //
|
||||
/// Print a message from the host
|
||||
fn print(&self, msg: &str);
|
||||
/// Log a message from the host
|
||||
fn log(&self, msg: &str);
|
||||
/// Log a warning from the host
|
||||
fn warn(&self, msg: &str);
|
||||
/// Log an error from the host
|
||||
fn error(&self, msg: &str);
|
||||
|
||||
// == Rhai Manipulation Stuff == //
|
||||
/// Perform an action on the current real-time rhai engine
|
||||
|
||||
Reference in New Issue
Block a user