pub struct Changelog {
pub maybe_unreleased: Option<ChangeSet>,
pub releases: Vec<Release>,
pub prologue: Option<String>,
pub epilogue: Option<String>,
}
Expand description
A log of changes for a specific project.
Fields§
§maybe_unreleased: Option<ChangeSet>
Unreleased changes don’t have version information associated with them.
releases: Vec<Release>
An ordered list of releases’ changes.
prologue: Option<String>
Any additional content that must appear at the beginning of the changelog.
epilogue: Option<String>
Any additional content that must appear at the end of the changelog
(e.g. historical changelog content prior to switching to unclog
).
Implementations§
source§impl Changelog
impl Changelog
sourcepub fn render_all(&self, config: &Config) -> String
pub fn render_all(&self, config: &Config) -> String
Renders the full changelog to a string.
sourcepub fn render_released(&self, config: &Config) -> String
pub fn render_released(&self, config: &Config) -> String
Renders all released versions’ entries, excluding unreleased ones.
sourcepub fn render_unreleased(&self, config: &Config) -> Result<String>
pub fn render_unreleased(&self, config: &Config) -> Result<String>
Renders just the unreleased changes to a string.
sourcepub fn init_dir<P: AsRef<Path>, R: AsRef<Path>, E: AsRef<Path>>(
config: &Config,
path: P,
maybe_prologue_path: Option<R>,
maybe_epilogue_path: Option<E>
) -> Result<()>
pub fn init_dir<P: AsRef<Path>, R: AsRef<Path>, E: AsRef<Path>>( config: &Config, path: P, maybe_prologue_path: Option<R>, maybe_epilogue_path: Option<E> ) -> Result<()>
Initialize a new (empty) changelog in the given path.
Creates the target folder if it doesn’t exist, and optionally copies an epilogue into it.
sourcepub fn generate_config<P, Q, S>(
config_path: P,
path: Q,
remote: S,
force: bool
) -> Result<()>
pub fn generate_config<P, Q, S>( config_path: P, path: Q, remote: S, force: bool ) -> Result<()>
Attempts to generate a configuration file for the changelog in the given path, inferring as many parameters as possible from its environment.
sourcepub fn read_from_dir<P>(config: &Config, path: P) -> Result<Self>
pub fn read_from_dir<P>(config: &Config, path: P) -> Result<Self>
Attempt to read a full changelog from the given directory.
sourcepub fn add_unreleased_entry<P, S, C, I, O>(
config: &Config,
path: P,
section: S,
maybe_component: Option<C>,
id: I,
content: O
) -> Result<()>
pub fn add_unreleased_entry<P, S, C, I, O>( config: &Config, path: P, section: S, maybe_component: Option<C>, id: I, content: O ) -> Result<()>
Adds a changelog entry with the given ID to the specified section in
the unreleased
folder.
sourcepub fn add_unreleased_entry_from_template(
config: &Config,
path: &Path,
section: &str,
component: Option<String>,
id: &str,
platform_id: PlatformId,
message: &str
) -> Result<()>
pub fn add_unreleased_entry_from_template( config: &Config, path: &Path, section: &str, component: Option<String>, id: &str, platform_id: PlatformId, message: &str ) -> Result<()>
Attempts to add an unreleased changelog entry from the given parameters, rendering them through the change template specified in the configuration file.
The change template is assumed to be in Handlebars format.
sourcepub fn render_unreleased_entry_from_template(
config: &Config,
path: &Path,
section: &str,
component: Option<String>,
id: &str,
platform_id: PlatformId,
message: &str
) -> Result<String>
pub fn render_unreleased_entry_from_template( config: &Config, path: &Path, section: &str, component: Option<String>, id: &str, platform_id: PlatformId, message: &str ) -> Result<String>
Renders an unreleased changelog entry from the given parameters to a string, making use of the change template specified in the configuration file.
The change template is assumed to be in Handlebars format.
sourcepub fn get_entry_path<P, R, S, C, I>(
config: &Config,
path: P,
release: R,
section: S,
component: Option<C>,
id: I
) -> PathBuf
pub fn get_entry_path<P, R, S, C, I>( config: &Config, path: P, release: R, section: S, component: Option<C>, id: I ) -> PathBuf
Compute the file system path to the entry with the given parameters.
sourcepub fn prepare_release_dir<P: AsRef<Path>, S: AsRef<str>>(
config: &Config,
path: P,
version: S
) -> Result<()>
pub fn prepare_release_dir<P: AsRef<Path>, S: AsRef<str>>( config: &Config, path: P, version: S ) -> Result<()>
Moves the unreleased
folder from our changelog to a directory whose
name is the given version.
sourcepub fn entries(&self) -> ChangelogEntryIter<'_>
pub fn entries(&self) -> ChangelogEntryIter<'_>
Facilitates iteration through all entries in this changelog, producing
EntryPath
instances such that one can trace the full path to each
entry. The order in which entries are produced is the order in which
they will be rendered if the changelog is built.
sourcepub fn find_duplicates_across_releases(
&self
) -> Vec<(EntryPath<'_>, EntryPath<'_>)>
pub fn find_duplicates_across_releases( &self ) -> Vec<(EntryPath<'_>, EntryPath<'_>)>
Returns a list of entries that are the same across releases within this changelog. Effectively compares just the entries themselves without regard for the release, section, component, etc.
Trait Implementations§
source§impl PartialEq for Changelog
impl PartialEq for Changelog
impl Eq for Changelog
impl StructuralPartialEq for Changelog
Auto Trait Implementations§
impl RefUnwindSafe for Changelog
impl Send for Changelog
impl Sync for Changelog
impl Unpin for Changelog
impl UnwindSafe for Changelog
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.