pub trait Plugable {
Show 13 methods
fn name(&self) -> String;
fn check(&self) -> Result<bool>;
fn prefix(&self) -> &str;
fn enable(&mut self);
fn disable(&mut self);
fn enabled(&self) -> bool;
fn init(&mut self, _branch: &Option<String>) -> Result<()> { ... }
fn add_prefix(&self, version: &dyn Display) -> String { ... }
fn remove_prefix(&self, version: &str) -> String { ... }
fn current_version(&self) -> Result<Option<Version>> { ... }
fn next_version(&self, _: &Version) -> Result<Option<Version>> { ... }
fn write(&self, _version: &str) -> Result<Vec<PathBuf>> { ... }
fn done(&self, _version: &str, _changed_files: &[&Path]) -> Result<()> { ... }
}
Expand description
Trait implemented by plugins which can read and write version information.
Pluggable must be implemented for all plugins, and contains basic functionality for working with the plugin, lifecycle hooks, and providing a name in order to enable/disable the plugin.
Required Methods
check is run first to determine whether a give plugin should be enabled for use.
Errors
When an error may be returned is determined by the specific implementation.
Provided Methods
Run any required initialization code.
Errors
Will never return an error by default; depends on the implementation in the implementing struct.
fn add_prefix(&self, version: &dyn Display) -> String
sourcefn remove_prefix(&self, version: &str) -> String
fn remove_prefix(&self, version: &str) -> String
Strip the prefix from the semver string.
sourcefn current_version(&self) -> Result<Option<Version>>
fn current_version(&self) -> Result<Option<Version>>
Calculate what the current version is.
Errors
Will never return an error by default; depends on the implementation in the implementing struct.
Calculate what the next version should be.
Errors
Will never return an error by default; depends on the implementation in the implementing struct.
Write the version to file(s).
Errors
May return an error depending on the particular plugin. See each plugin’s documentation for details.