[−][src]Struct parse_changelog::Parser
A changelog parser.
Implementations
impl Parser
[src]
pub fn new() -> Self
[src]
Creates a new changelog parser.
pub fn version_format(
&mut self,
version_format: &str
) -> Result<&mut Self, Error>
[src]
&mut self,
version_format: &str
) -> Result<&mut Self, Error>
Sets the version format.
## v0.1.0 -- 2020-01-01
^^^^^
The default version format is based on Semantic Versioning and is the following regular expression:
^\d+\.\d+\.\d+(-[\w\.-]+)?(\+[\w\.-]+)?
Note: Most projects that adopt Semantic Versioning do not need to change this.
To customize the text before the version number (e.g., "v" in "# v0.1.0",
"Version " in "# Version 0.1.0", etc.), use the prefix_format
method
instead of this method.
Errors
Returns an error if any of the following:
- The specified version format is not valid regular expression or supported by regex crate.
- The specified version format is empty or contains only whitespace.
pub fn prefix_format(&mut self, prefix_format: &str) -> Result<&mut Self, Error>
[src]
Sets the prefix format.
"Prefix" means the range from the first non-whitespace character after heading to the character before the version (including whitespace characters). For example:
## Version 0.1.0 -- 2020-01-01
^^^^^^^^
## v0.1.0 -- 2020-01-01
^
The default prefix format is the following regular expression:
^(v|Version |Release )?
Errors
Returns an error if any of the following:
- The specified prefix format is not valid regular expression or supported by regex crate.
- The specified prefix format is empty or contains only whitespace.
pub fn parse<'a>(
&self,
text: &'a str
) -> Result<IndexMap<&'a str, Release<'a>>, Error>
[src]
&self,
text: &'a str
) -> Result<IndexMap<&'a str, Release<'a>>, Error>
Parses release notes from the given text
.
See crate level documentation for changelog and version format supported by default.
Errors
Returns an error if any of the following:
- There are multiple release notes for one version.
- No release was found. This usually means that the changelog isn't written in the supported format, or that the specified version format is wrong if you specify your own version format.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Parser
impl Send for Parser
impl Sync for Parser
impl Unpin for Parser
impl UnwindSafe for Parser
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,