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 ) -> PathBufwhere 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.

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

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.