Struct CustomPlugin

Source
pub struct CustomPlugin { /* private fields */ }
Expand description

A plugin definition

Implementations§

Source§

impl CustomPlugin

Source

pub fn new(id: &str) -> Result<Self>

Create a new plugin definition

Source

pub fn with_settings(id: &str, settings: PluginSettings) -> Result<Self>

Create a new plugin definition with more advanced settings

Source

pub fn from_manifest_file(id: &str, manifest: &str) -> Result<Self>

Create a new plugin definition from manifest file contents

Source

pub fn from_manifest(id: &str, manifest: &PluginManifest) -> Result<Self>

Create a new plugin definition from a manifest

Source

pub fn get_id(&self) -> &str

Get the ID of the plugin

Source

pub fn on_load( &mut self, f: impl FnOnce(HookContext<'_, OnLoad>, <OnLoad as Hook>::Arg) -> Result<<OnLoad as Hook>::Result>, ) -> Result<()>

Bind to the subcommand hook Bind to the on_load hook

Source

pub fn subcommand( &mut self, f: impl FnOnce(HookContext<'_, Subcommand>, <Subcommand as Hook>::Arg) -> Result<<Subcommand as Hook>::Result>, ) -> Result<()>

Bind to the subcommand hook Bind to the subcommand hook

Source

pub fn modify_instance_config( &mut self, f: impl FnOnce(HookContext<'_, ModifyInstanceConfig>, <ModifyInstanceConfig as Hook>::Arg) -> Result<<ModifyInstanceConfig as Hook>::Result>, ) -> Result<()>

Bind to the subcommand hook Bind to the modify_instance_config hook

Source

pub fn add_versions( &mut self, f: impl FnOnce(HookContext<'_, AddVersions>, <AddVersions as Hook>::Arg) -> Result<<AddVersions as Hook>::Result>, ) -> Result<()>

Bind to the subcommand hook Bind to the add_versions hook

Source

pub fn on_instance_setup( &mut self, f: impl FnOnce(HookContext<'_, OnInstanceSetup>, <OnInstanceSetup as Hook>::Arg) -> Result<<OnInstanceSetup as Hook>::Result>, ) -> Result<()>

Bind to the subcommand hook Bind to the on_instance_setup hook

Source

pub fn on_instance_launch( &mut self, f: impl FnOnce(HookContext<'_, OnInstanceLaunch>, <OnInstanceLaunch as Hook>::Arg) -> Result<<OnInstanceLaunch as Hook>::Result>, ) -> Result<()>

Bind to the subcommand hook Bind to the on_instance_launch hook

Source

pub fn while_instance_launch( &mut self, f: impl FnOnce(HookContext<'_, WhileInstanceLaunch>, <WhileInstanceLaunch as Hook>::Arg) -> Result<<WhileInstanceLaunch as Hook>::Result>, ) -> Result<()>

Bind to the subcommand hook Bind to the while_instance_launch hook

Source

pub fn on_instance_stop( &mut self, f: impl FnOnce(HookContext<'_, OnInstanceStop>, <OnInstanceStop as Hook>::Arg) -> Result<<OnInstanceStop as Hook>::Result>, ) -> Result<()>

Bind to the subcommand hook Bind to the on_instance_stop hook

Source

pub fn custom_package_instruction( &mut self, f: impl FnOnce(HookContext<'_, CustomPackageInstruction>, <CustomPackageInstruction as Hook>::Arg) -> Result<<CustomPackageInstruction as Hook>::Result>, ) -> Result<()>

Bind to the subcommand hook Bind to the custom_package_instruction hook

Source

pub fn handle_auth( &mut self, f: impl FnOnce(HookContext<'_, HandleAuth>, <HandleAuth as Hook>::Arg) -> Result<<HandleAuth as Hook>::Result>, ) -> Result<()>

Bind to the subcommand hook Bind to the handle_auth hook

Source

pub fn add_translations( &mut self, f: impl FnOnce(HookContext<'_, AddTranslations>, <AddTranslations as Hook>::Arg) -> Result<<AddTranslations as Hook>::Result>, ) -> Result<()>

Bind to the subcommand hook Bind to the add_translations hook

Source

pub fn add_instance_transfer_formats( &mut self, f: impl FnOnce(HookContext<'_, AddInstanceTransferFormats>, <AddInstanceTransferFormats as Hook>::Arg) -> Result<<AddInstanceTransferFormats as Hook>::Result>, ) -> Result<()>

Bind to the subcommand hook Bind to the add_instance_transfer_formats hook

Source

pub fn export_instance( &mut self, f: impl FnOnce(HookContext<'_, ExportInstance>, <ExportInstance as Hook>::Arg) -> Result<<ExportInstance as Hook>::Result>, ) -> Result<()>

Bind to the subcommand hook Bind to the export_instance hook

Source

pub fn import_instance( &mut self, f: impl FnOnce(HookContext<'_, ImportInstance>, <ImportInstance as Hook>::Arg) -> Result<<ImportInstance as Hook>::Result>, ) -> Result<()>

Bind to the subcommand hook Bind to the import_instance hook

Source

pub fn add_supported_game_modifications( &mut self, f: impl FnOnce(HookContext<'_, AddSupportedGameModifications>, <AddSupportedGameModifications as Hook>::Arg) -> Result<<AddSupportedGameModifications as Hook>::Result>, ) -> Result<()>

Bind to the subcommand hook Bind to the add_supported_game_modifications hook

Auto Trait Implementations§

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T