Struct unclog::Changelog

source ·
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

source

pub fn is_empty(&self) -> bool

Checks whether this changelog is empty.

source

pub fn render_all(&self, config: &Config) -> String

Renders the full changelog to a string.

source

pub fn render_released(&self, config: &Config) -> String

Renders all released versions’ entries, excluding unreleased ones.

source

pub fn render_unreleased(&self, config: &Config) -> Result<String>

Renders just the unreleased changes to a string.

source

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.

source

pub fn generate_config<P, Q, S>( config_path: P, path: Q, remote: S, force: bool ) -> Result<()>
where P: AsRef<Path>, Q: AsRef<Path>, S: AsRef<str>,

Attempts to generate a configuration file for the changelog in the given path, inferring as many parameters as possible from its environment.

source

pub fn read_from_dir<P>(config: &Config, path: P) -> Result<Self>
where P: AsRef<Path>,

Attempt to read a full changelog from the given directory.

source

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<()>
where P: AsRef<Path>, S: AsRef<str>, C: AsRef<str>, I: AsRef<str>, O: AsRef<str>,

Adds a changelog entry with the given ID to the specified section in the unreleased folder.

source

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.

source

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.

source

pub fn get_entry_path<P, R, S, C, I>( config: &Config, path: P, release: R, section: S, component: Option<C>, id: I ) -> PathBuf
where P: AsRef<Path>, R: AsRef<str>, S: AsRef<str>, C: AsRef<str>, I: AsRef<str>,

Compute the file system path to the entry with the given parameters.

source

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.

source

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.

source

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 Clone for Changelog

source§

fn clone(&self) -> Changelog

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Changelog

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Hash for Changelog

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for Changelog

source§

fn eq(&self, other: &Changelog) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Changelog

source§

impl StructuralPartialEq for Changelog

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.