Trait dprint_core::plugins::SyncPluginHandler
source · [−]pub trait SyncPluginHandler<TConfiguration: Clone + Serialize> {
fn resolve_config(
&mut self,
config: ConfigKeyMap,
global_config: &GlobalConfiguration
) -> ResolveConfigurationResult<TConfiguration>;
fn plugin_info(&mut self) -> PluginInfo;
fn license_text(&mut self) -> String;
fn format(
&mut self,
file_path: &Path,
file_text: &str,
config: &TConfiguration,
format_with_host: impl FnMut(&Path, String, &ConfigKeyMap) -> FormatResult
) -> FormatResult;
}
Expand description
Trait for implementing a Wasm plugin. Eventually this will be combined with AsyncPluginHandler.
Required methods
fn resolve_config(
&mut self,
config: ConfigKeyMap,
global_config: &GlobalConfiguration
) -> ResolveConfigurationResult<TConfiguration>
fn resolve_config(
&mut self,
config: ConfigKeyMap,
global_config: &GlobalConfiguration
) -> ResolveConfigurationResult<TConfiguration>
Resolves configuration based on the provided config map and global configuration.
fn plugin_info(&mut self) -> PluginInfo
fn plugin_info(&mut self) -> PluginInfo
Gets the plugin’s plugin info.
fn license_text(&mut self) -> String
fn license_text(&mut self) -> String
Gets the plugin’s license text.
fn format(
&mut self,
file_path: &Path,
file_text: &str,
config: &TConfiguration,
format_with_host: impl FnMut(&Path, String, &ConfigKeyMap) -> FormatResult
) -> FormatResult
fn format(
&mut self,
file_path: &Path,
file_text: &str,
config: &TConfiguration,
format_with_host: impl FnMut(&Path, String, &ConfigKeyMap) -> FormatResult
) -> FormatResult
Formats the provided file text based on the provided file path and configuration.