Skip to main content

GCPlugin

Struct GCPlugin 

pub struct GCPlugin<T: GCPluginCallbackHandler> {
    plugin_instances: HashMap<String, GCPluginInstance<T>>,
    lib: PluginDLL,
}
Expand description

GCPlugin holds the plugin instances for a particular plugin library.

Fields§

§plugin_instances: HashMap<String, GCPluginInstance<T>>§lib: PluginDLL

Implementations§

§

impl<T: GCPluginCallbackHandler> GCPlugin<T>

pub(crate) fn new(lib: PathBuf) -> Result<Self, GCPluginManagerError>

Creates a new plugin by loading it’s DLL using GCPluginDLL.

pub(crate) fn add_instance( &mut self, instance_name: &str, callback_handler: Box<T>, ) -> Result<GCPluginInstance<T>, GCPluginManagerError>

Adds a new instance to the plugin without starting it.

pub(crate) fn stop_instance( &self, instance_name: &str, ) -> Result<(), GCPluginManagerError>

pub(crate) fn start_instance( &mut self, config: GCPluginInstanceConfig<'_>, instance_name: &str, ) -> Result<GCPluginInstance<T>, GCPluginManagerError>

Starts the instance by initializing it with the given configuration and callback handler.

pub(crate) fn remove_instance( &mut self, instance_name: &str, ) -> Result<(), GCPluginManagerError>

This function will remove the instance from the plugin and shutdown the instance.

pub(crate) fn get_plugin_dll(&self) -> &PluginDLL

Returns the plugin DLL.

pub fn get_plugin_info(&self) -> GCPluginInfo

Returns the plugin info by calling gc_plugin_get_info

pub fn get_num_instances(&self) -> usize

Returns the number of instances for this plugin.

pub fn get_plugin_path(&self) -> &Path

Returns the path to the plugin DLL.

pub fn iter(&self) -> impl Iterator<Item = &GCPluginInstance<T>>

Returns an iterator over all instances for this plugin.

pub fn get_instance(&self, instance_name: &str) -> Option<&GCPluginInstance<T>>

Trait Implementations§

§

impl<T: GCPluginCallbackHandler> Debug for GCPlugin<T>

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
§

impl<T: GCPluginCallbackHandler> Drop for GCPlugin<T>

§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<T> Freeze for GCPlugin<T>

§

impl<T> RefUnwindSafe for GCPlugin<T>
where T: RefUnwindSafe,

§

impl<T> Send for GCPlugin<T>

§

impl<T> Sync for GCPlugin<T>

§

impl<T> Unpin for GCPlugin<T>

§

impl<T> UnsafeUnpin for GCPlugin<T>

§

impl<T> UnwindSafe for GCPlugin<T>
where T: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.