pub trait PluginHandler: Sized {
type RecipientV1: RecipientPluginV1;
type IdentityV1: IdentityPluginV1;
// Provided methods
fn recipient_v1(self) -> Result<Self::RecipientV1> { ... }
fn identity_v1(self) -> Result<Self::IdentityV1> { ... }
}Expand description
The interfaces that age implementations will use to interact with an age plugin.
This trait exists to encapsulate the set of arguments to run_state_machine that
different plugins may want to provide.
§How to implement this trait
§Full plugins
- Set all associated types to your plugin’s implementations.
- Override all default methods of the trait.
§Recipient-only plugins
- Set
PluginHandler::RecipientV1to your plugin’s implementation. - Override
PluginHandler::recipient_v1to return an instance of your type. - Set
PluginHandler::IdentityV1tostd::convert::Infallible. - Don’t override
PluginHandler::identity_v1.
§Identity-only plugins
- Set
PluginHandler::RecipientV1tostd::convert::Infallible. - Don’t override
PluginHandler::recipient_v1. - Set
PluginHandler::IdentityV1to your plugin’s implementation. - Override
PluginHandler::identity_v1to return an instance of your type.
Required Associated Types§
Sourcetype RecipientV1: RecipientPluginV1
type RecipientV1: RecipientPluginV1
The plugin’s recipient-v1 implementation.
Sourcetype IdentityV1: IdentityPluginV1
type IdentityV1: IdentityPluginV1
The plugin’s identity-v1 implementation.
Provided Methods§
Sourcefn recipient_v1(self) -> Result<Self::RecipientV1>
fn recipient_v1(self) -> Result<Self::RecipientV1>
Returns an instance of the plugin’s recipient-v1 implementation.
Sourcefn identity_v1(self) -> Result<Self::IdentityV1>
fn identity_v1(self) -> Result<Self::IdentityV1>
Returns an instance of the plugin’s identity-v1 implementation.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.