style: code style

This commit is contained in:
2020-12-27 14:51:24 +08:00
parent 8d34b85a9c
commit cc10c8effd
4 changed files with 436 additions and 84 deletions

View File

@@ -0,0 +1,355 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "abi_stable"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "112fbc83f18cf0f12358975cac27eb4556cc5d777bde72312e0cec7a294e1699"
dependencies = [
"abi_stable_derive",
"abi_stable_shared",
"core_extensions",
"crossbeam-channel",
"generational-arena",
"libloading",
"lock_api",
"parking_lot",
"repr_offset",
"rustc_version",
"serde",
"serde_derive",
"serde_json",
]
[[package]]
name = "abi_stable_derive"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1be19f4da4a4a1f2537f1f14d8f0917c07758acb7419d3bad9e9d62a11f6b5b0"
dependencies = [
"abi_stable_shared",
"as_derive_utils",
"core_extensions",
"proc-macro2",
"quote",
"rustc_version",
"syn",
"typed-arena",
]
[[package]]
name = "abi_stable_shared"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a96112d6a13f37dd1cc2a2f07f7f12b7c3d176b6eec36e7987432a70fece8b48"
dependencies = [
"core_extensions",
]
[[package]]
name = "arrayvec"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
[[package]]
name = "as_derive_utils"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffc3613a62c7b739739a2cb1ee166ac275f16c5b86caf454ba21a2f79f04b025"
dependencies = [
"core_extensions",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "autocfg"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
[[package]]
name = "cfg-if"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "core_extensions"
version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff55d62b113b98e0b0a55112741376c4cfe36f1290d18392c2c5727e09629a7f"
dependencies = [
"rustc_version",
]
[[package]]
name = "crossbeam-channel"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775"
dependencies = [
"cfg-if 1.0.0",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-utils"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02d96d1e189ef58269ebe5b97953da3274d83a93af647c2ddd6f9dab28cedb8d"
dependencies = [
"autocfg",
"cfg-if 1.0.0",
"lazy_static",
]
[[package]]
name = "example_interface"
version = "0.1.0"
dependencies = [
"abi_stable",
"arrayvec",
"core_extensions",
"serde",
"serde_json",
]
[[package]]
name = "generational-arena"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e1d3b771574f62d0548cee0ad9057857e9fc25d7a3335f140c84f6acd0bf601"
dependencies = [
"cfg-if 0.1.10",
]
[[package]]
name = "instant"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec"
dependencies = [
"cfg-if 1.0.0",
]
[[package]]
name = "itoa"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6"
[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.81"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb"
[[package]]
name = "libloading"
version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9367bdfa836b7e3cf895867f7a570283444da90562980ec2263d6e1569b16bc"
dependencies = [
"cfg-if 1.0.0",
"winapi",
]
[[package]]
name = "lock_api"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd96ffd135b2fd7b973ac026d28085defbe8983df057ced3eb4f2130b0831312"
dependencies = [
"scopeguard",
]
[[package]]
name = "parking_lot"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb"
dependencies = [
"instant",
"lock_api",
"parking_lot_core",
]
[[package]]
name = "parking_lot_core"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ccb628cad4f84851442432c60ad8e1f607e29752d0bf072cbd0baf28aa34272"
dependencies = [
"cfg-if 1.0.0",
"instant",
"libc",
"redox_syscall",
"smallvec",
"winapi",
]
[[package]]
name = "proc-macro2"
version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
dependencies = [
"unicode-xid",
]
[[package]]
name = "quote"
version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df"
dependencies = [
"proc-macro2",
]
[[package]]
name = "redox_syscall"
version = "0.1.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
[[package]]
name = "repr_offset"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a68e33940e1f1e7ab77493ad7d983dba544ce72185c61d4b1b23e6c32dd2a165"
dependencies = [
"rustc_version",
]
[[package]]
name = "rustc_version"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
dependencies = [
"semver",
]
[[package]]
name = "ryu"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
[[package]]
name = "scopeguard"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "semver"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
dependencies = [
"semver-parser",
]
[[package]]
name = "semver-parser"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]]
name = "serde"
version = "1.0.118"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06c64263859d87aa2eb554587e2d23183398d617427327cf2b3d0ed8c69e4800"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.118"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c84d3526699cd55261af4b941e4e725444df67aa4f9e6a3564f18030d12672df"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "serde_json"
version = "1.0.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1500e84d27fe482ed1dc791a56eddc2f230046a040fa908c08bda1d9fb615779"
dependencies = [
"itoa",
"ryu",
"serde",
]
[[package]]
name = "smallvec"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae524f056d7d770e174287294f562e95044c68e88dec909a00d2094805db9d75"
[[package]]
name = "syn"
version = "1.0.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9802ddde94170d186eeee5005b798d9c159fa970403f1be19976d0cfb939b72"
dependencies = [
"proc-macro2",
"quote",
"unicode-xid",
]
[[package]]
name = "typed-arena"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0685c84d5d54d1c26f7d3eb96cd41550adb97baed141a761cf335d3d33bcd0ae"
[[package]]
name = "unicode-xid"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"

View File

@@ -1,4 +1,4 @@
use crate::{PluginId,WhichPlugin};
use crate::{PluginId, WhichPlugin};
use std::fmt;
use serde::{
@@ -11,8 +11,8 @@ use abi_stable::{StableAbi, std_types::*};
// This is intentionally not `#[derive(StableAbi)]`,
// since it can be extended in minor versions of the interface.
// I has to be serialized to pass it through ffi.
#[derive(Debug,Clone,PartialEq,Eq,Serialize,Deserialize)]
pub enum BasicCommand{
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum BasicCommand {
GetCommands,
}
@@ -21,8 +21,8 @@ pub enum BasicCommand{
// This is intentionally not `#[derive(StableAbi)]`,
// since it can be extended in minor versions of the interface.
// I has to be serialized to pass it through ffi.
#[derive(Debug,Clone,PartialEq,Eq,Serialize,Deserialize)]
pub enum BasicRetVal{
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum BasicRetVal {
GetCommands(RVec<CommandDescription>),
}
@@ -30,17 +30,17 @@ pub enum BasicRetVal{
// This is intentionally not `#[derive(StableAbi)]`,
// since it can be extended in minor versions of the interface.
// I has to be serialized to pass it through ffi.
#[derive(Debug,Clone,PartialEq,Eq,Serialize,Deserialize)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CommandUnion<T>{
pub enum CommandUnion<T> {
ForPlugin(T),
Basic(BasicCommand),
}
#[derive(Debug,Clone,PartialEq,Eq,Serialize,Deserialize)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ReturnValUnion<T>{
pub enum ReturnValUnion<T> {
ForPlugin(T),
Basic(BasicRetVal),
}
@@ -51,15 +51,15 @@ pub enum ReturnValUnion<T>{
/// A partially deserialize command,that only deserialized its variant.
#[derive(Debug,Clone)]
pub struct WhichVariant{
#[derive(Debug, Clone)]
pub struct WhichVariant {
pub variant:RString,
}
struct WhichVariantVisitor;
impl<'de> Visitor<'de> for WhichVariantVisitor{
impl<'de> Visitor<'de> for WhichVariantVisitor {
type Value = WhichVariant;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
@@ -108,33 +108,33 @@ impl<'de> Deserialize<'de> for WhichVariant{
/// Denotes this as a command type.
pub trait CommandTrait:Serialize{
pub trait CommandTrait:Serialize {
type Returns:DeserializeOwned;
}
impl CommandTrait for BasicCommand{
type Returns=BasicRetVal;
impl CommandTrait for BasicCommand {
type Returns = BasicRetVal;
}
/// Describes a command.
#[repr(C)]
#[derive(Debug,Clone,PartialEq,Eq,Serialize,Deserialize,StableAbi)]
pub struct CommandDescription{
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, StableAbi)]
pub struct CommandDescription {
/// A description of what this command does.
pub name:RCow<'static,str>,
pub name:RCow<'static, str>,
/// A description of what this command does,
/// optionally with a description of the command format.
pub description:RCow<'static,str>,
pub description:RCow<'static, str>,
}
impl CommandDescription{
impl CommandDescription {
pub fn from_literals(
name:&'static str,
description:&'static str,
)->Self{
CommandDescription{
) -> Self {
CommandDescription {
name:name.into(),
description:description.into(),
}
@@ -146,8 +146,8 @@ impl CommandDescription{
#[repr(C)]
#[derive(Debug,Clone,PartialEq,Eq,StableAbi)]
pub struct AsyncCommand{
#[derive(Debug, Clone, PartialEq, Eq, StableAbi)]
pub struct AsyncCommand {
pub from:PluginId,
pub which_plugin:WhichPlugin,
pub command:RString,

View File

@@ -1,11 +1,11 @@
use crate::{commands::CommandDescription,WhichPlugin,WhichCommandRet};
use crate::{commands::CommandDescription, WhichPlugin, WhichCommandRet};
use abi_stable::{StableAbi, std_types::{RBoxError,RBox,RString,RVec}};
use std::{error::Error as ErrorTrait, fmt::{self,Display}};
use abi_stable::{StableAbi, std_types::{RBoxError, RBox, RString, RVec}};
use std::{error::Error as ErrorTrait, fmt::{self, Display}};
use core_extensions::strings::StringExt;
#[repr(u8)]
#[derive(Debug,StableAbi)]
#[derive(Debug, StableAbi)]
pub enum Error{
/// An error produced by `serde_json::to_string`.
Serialize(RBoxError,WhichCommandRet),
@@ -27,8 +27,8 @@ pub enum Error{
/// Represents a command or return value that wasn't supported.
#[repr(C)]
#[derive(Debug,StableAbi)]
pub struct Unsupported{
#[derive(Debug, StableAbi)]
pub struct Unsupported {
/// The name of the plugin for which the command/return value wasn't supported.
pub plugin_name:RString,
/// The command/return value that wasn't supported.
@@ -40,33 +40,33 @@ pub struct Unsupported{
}
impl Error{
pub fn unsupported_command(what:Unsupported)->Self{
impl Error {
pub fn unsupported_command(what:Unsupported) -> Self {
Error::UnsupportedCommand(RBox::new(what))
}
pub fn unsupported_return_value(what:Unsupported)->Self{
pub fn unsupported_return_value(what:Unsupported) -> Self {
Error::UnsupportedReturnValue(RBox::new(what))
}
}
impl Display for Error{
fn fmt(&self,f:&mut fmt::Formatter<'_>)->fmt::Result {
impl Display for Error {
fn fmt(&self, f:&mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Error::Serialize(e,which)=>{
let which=match which {
WhichCommandRet::Command=>"command",
WhichCommandRet::Return=>"return value",
Error::Serialize(e, which) => {
let which = match which {
WhichCommandRet::Command => "command",
WhichCommandRet::Return => "return value",
};
writeln!(f,"Error happened while serializing the {}:\n{}\n",which,e)
}
Error::Deserialize(e,which)=>{
let which=match which {
WhichCommandRet::Command=>"command",
WhichCommandRet::Return=>"return value",
Error::Deserialize(e, which) => {
let which = match which {
WhichCommandRet::Command => "command",
WhichCommandRet::Return => "return value",
};
writeln!(f,"Error happened while deserializing {}:\n{}\n",which,e)
writeln!(f,"Error happened while deserializing {}:\n{}\n", which, e)
}
Error::UnsupportedCommand(v)=>{
Error::UnsupportedCommand(v) => {
writeln!(
f,
"Plugin '{}' ooes not support this command:\n\
@@ -77,7 +77,6 @@ impl Display for Error{
v.plugin_name,
v.command_name,
v.error,
)?;
for supported in &v.supported_commands {
@@ -94,7 +93,7 @@ impl Display for Error{
Ok(())
}
Error::UnsupportedReturnValue(v)=>
Error::UnsupportedReturnValue(v) =>
writeln!(
f,
"Unrecognized return value from '{}',named:\n\
@@ -105,14 +104,14 @@ impl Display for Error{
v.command_name,
v.error,
),
Error::InvalidPlugin(wc)=>
Error::InvalidPlugin(wc) =>
writeln!(
f,
"Attempted to access a nonexistent plugin with the WhichPlugin:\n\t{:?}\n",
wc
),
Error::Custom(e)=>Display::fmt(e,f),
Error::Many(list)=>{
Error::Custom(e) => Display::fmt(e, f),
Error::Many(list) => {
for e in list {
writeln!(f,"{}",e)?;
}

View File

@@ -19,23 +19,21 @@ use abi_stable::{
external_types::{
crossbeam_channel::RSender,
},
std_types::{RBox, RCow, RVec, RStr, RString,RResult, ROption, ROk,RSome},
std_types::{RBox, RCow, RVec, RStr, RString, RResult, ROption, ROk, RSome},
};
use serde::{Serialize,Deserialize};
use serde::{Serialize, Deserialize};
mod commands;
mod error;
mod which_plugin;
mod vec_from_map;
pub mod utils;
pub mod utils;
pub use self::{
commands::{
BasicCommand,BasicRetVal,CommandDescription,CommandTrait,WhichVariant,AsyncCommand,
BasicCommand, BasicRetVal, CommandDescription, CommandTrait, WhichVariant, AsyncCommand,
},
error::{Error,Unsupported},
error::{Error, Unsupported},
which_plugin::WhichPlugin,
vec_from_map::VecFromMap,
};
@@ -48,8 +46,8 @@ pub use self::{
The identifier for a plugin.
*/
#[repr(C)]
#[derive(Debug,Clone,PartialEq,Eq,StableAbi,Serialize,Deserialize)]
pub struct PluginId{
#[derive(Debug, Clone, PartialEq, Eq, StableAbi, Serialize, Deserialize)]
pub struct PluginId {
pub named:RCow<'static,str>,
/// The number of the instance of this Plugin.
pub instance:u64,
@@ -58,8 +56,8 @@ pub struct PluginId{
/// Describes whether a boxed error is a command or a return value.
#[repr(u8)]
#[derive(Debug,Clone,PartialEq,Eq,StableAbi,Serialize,Deserialize)]
pub enum WhichCommandRet{
#[derive(Debug, Clone, PartialEq, Eq, StableAbi, Serialize, Deserialize)]
pub enum WhichCommandRet {
Command,
Return,
}
@@ -67,21 +65,21 @@ pub enum WhichCommandRet{
/// The response from having called `ApplicationMut::send_command_to_plugin` ealier.
#[repr(C)]
#[derive(Debug,Clone,PartialEq,Eq,StableAbi)]
pub struct PluginResponse<'a>{
#[derive(Debug, Clone, PartialEq, Eq, StableAbi)]
pub struct PluginResponse<'a> {
/// The id of the plugin that is responding.
pub plugin_id:PluginId,
/// The response from the plugin
pub response:RCow<'a,str>,
pub response:RCow<'a, str>,
}
impl<'a> PluginResponse<'a>{
pub fn owned_response(plugin_id:PluginId,response:RString)->Self{
Self{plugin_id,response:response.into()}
impl<'a> PluginResponse<'a> {
pub fn owned_response(plugin_id: PluginId, response: RString) -> Self {
Self{plugin_id, response: response.into()}
}
pub fn borrowed_response(plugin_id:PluginId,response:RStr<'a>)->Self{
Self{plugin_id,response:response.into()}
pub fn borrowed_response(plugin_id: PluginId, response: RStr<'a>) -> Self {
Self{plugin_id, response: response.into()}
}
}
@@ -90,7 +88,7 @@ impl<'a> PluginResponse<'a>{
///////////////////////////////////////////////////////////////////////////////
pub type PluginType=Plugin_TO<'static,RBox<()>>;
pub type PluginType=Plugin_TO<'static, RBox<()>>;
/**
@@ -107,7 +105,7 @@ pub trait Plugin {
&mut self,
command: RStr<'_>,
app:ApplicationMut<'_>,
)->RResult<RString,Error>;
) -> RResult<RString, Error>;
/// Handles a response from another Plugin,
/// from having called `ApplicationMut::send_command_to_plugin` ealier.
@@ -115,15 +113,15 @@ pub trait Plugin {
&mut self,
response:PluginResponse<'a>,
_app:ApplicationMut<'_>,
)->RResult<ROption<PluginResponse<'a>>,Error>{
) -> RResult<ROption<PluginResponse<'a>>, Error> {
ROk(RSome(response))
}
/// Gets the PluginId that was passed to this plugin in its constructor.
fn plugin_id(&self)->&PluginId;
fn plugin_id(&self) -> &PluginId;
/// Gets a description of all commands from this Plugin.
fn list_commands(&self)->RVec<CommandDescription>;
fn list_commands(&self) -> RVec<CommandDescription>;
/*
Closes the plugin,
@@ -144,7 +142,7 @@ bumps its "major" version,
at which point it would be moved to the last method at the time.
*/
#[sabi(last_prefix_field)]
fn close(self,app:ApplicationMut<'_>);
fn close(self, app:ApplicationMut<'_>);
}
@@ -174,7 +172,7 @@ at which point it would be moved to the last field at the time.
*/
#[sabi(last_prefix_field)]
pub new: extern "C" fn(RSender<AsyncCommand>,PluginId) -> RResult<PluginType,Error>,
pub new: extern "C" fn(RSender<AsyncCommand>, PluginId) -> RResult<PluginType, Error>,
}
@@ -191,7 +189,7 @@ impl RootModule for PluginMod_Ref {
/// A mutable reference to the application implementation.
pub type ApplicationMut<'a>=Application_TO<'a,&'a mut ()>;
pub type ApplicationMut<'a> = Application_TO<'a, &'a mut ()>;
#[sabi_trait]
@@ -204,10 +202,10 @@ pub trait Application{
/// Returns an `Error::InvalidPlugin` if `which_plugin` is invalid.
fn send_command_to_plugin(
&mut self,
from:&PluginId,
which_plugin:WhichPlugin,
command:RString,
)->RResult<(),Error>;
from: &PluginId,
which_plugin: WhichPlugin,
command: RString,
) -> RResult<(), Error>;
/**
Gets the `PluginId`s of the plugins specified by `which_plugin`.
@@ -224,11 +222,11 @@ at which point it would be moved to the last method at the time.
*/
#[sabi(last_prefix_field)]
fn get_plugin_id(&self,which_plugin:WhichPlugin)->RResult<RVec<PluginId>,Error>;
fn get_plugin_id(&self, which_plugin:WhichPlugin) -> RResult<RVec<PluginId>, Error>;
/// Gets the sender end of a channel to send commands to the application/other plugins.
fn sender(&self)->RSender<AsyncCommand>;
fn sender(&self) -> RSender<AsyncCommand>;
/// Gets the PluginId of all loaded plugins
fn loaded_plugins(&self)->RVec<PluginId>;
fn loaded_plugins(&self) -> RVec<PluginId>;
}