Trait AsyncPluginHandler

Source
pub trait AsyncPluginHandler: 'static {
    type Configuration: Serialize + Clone + Send + Sync;

    // Required methods
    fn plugin_info(&self) -> PluginInfo;
    fn license_text(&self) -> String;
    fn resolve_config<'life0, 'async_trait>(
        &'life0 self,
        config: ConfigKeyMap,
        global_config: GlobalConfiguration,
    ) -> Pin<Box<dyn Future<Output = PluginResolveConfigurationResult<Self::Configuration>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn format<'life0, 'async_trait>(
        &'life0 self,
        request: FormatRequest<Self::Configuration>,
        format_with_host: impl 'async_trait + FnMut(HostFormatRequest) -> LocalBoxFuture<'static, FormatResult> + 'static,
    ) -> Pin<Box<dyn Future<Output = FormatResult> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn check_config_updates<'life0, 'async_trait>(
        &'life0 self,
        _message: CheckConfigUpdatesMessage,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ConfigChange>>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Trait for implementing a process plugin.

Required Associated Types§

Required Methods§

Source

fn plugin_info(&self) -> PluginInfo

Gets the plugin’s plugin info.

Source

fn license_text(&self) -> String

Gets the plugin’s license text.

Source

fn resolve_config<'life0, 'async_trait>( &'life0 self, config: ConfigKeyMap, global_config: GlobalConfiguration, ) -> Pin<Box<dyn Future<Output = PluginResolveConfigurationResult<Self::Configuration>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Resolves configuration based on the provided config map and global configuration.

Source

fn format<'life0, 'async_trait>( &'life0 self, request: FormatRequest<Self::Configuration>, format_with_host: impl 'async_trait + FnMut(HostFormatRequest) -> LocalBoxFuture<'static, FormatResult> + 'static, ) -> Pin<Box<dyn Future<Output = FormatResult> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Formats the provided file text based on the provided file path and configuration.

Provided Methods§

Source

fn check_config_updates<'life0, 'async_trait>( &'life0 self, _message: CheckConfigUpdatesMessage, ) -> Pin<Box<dyn Future<Output = Result<Vec<ConfigChange>>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Updates the config key map. This will be called after the CLI has upgraded the plugin in dprint config update.

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.

Implementors§