pub struct Sem;
Expand description
Scheme for formats that have only semantic specifiers, such as <MAJOR>.<MINOR>.<PATCH>
.
Sem behaves almost exactly like the SemVer scheme, but with a few differences.
See the available specifiers for this scheme in the table.
§Rules
- The first specifier must be
MAJOR
. MINOR
andPATCH
are not required. IfMINOR
is present, it must be afterMAJOR
, and ifPATCH
is present, it must be afterMINOR
.- As for all schemes, arbitrary literals can be placed in the format string. For example, dots,
hyphens, or any other character(s) can be used, such as
v<MAJOR>#<MINOR>-p<PATCH>
.
§Example Formats
<MAJOR>.<MINOR>.<PATCH>
: Major, minor, and patch. Dot-separated.v<MAJOR>.<MINOR>
:v
followed by major and minor. Dot-separated.
Implementations§
source§impl Sem
impl Sem
sourcepub fn next_version_string(
format_str: &str,
version_str: &str,
level: SemLevel
) -> Result<String, CompositeError>
pub fn next_version_string( format_str: &str, version_str: &str, level: SemLevel ) -> Result<String, CompositeError>
Increments the version string (formatted by the format string) by the given semantic specifier and returns the new version’s string.
This is a convenience method that creates a temporary Format
and Version
with
Scheme::new_version
, and increments it with
Version::next
.
§Example
use nextver::prelude::*;
let next_str = Sem::next_version_string(
"<MAJOR>.<MINOR>.<PATCH>",
"1.2.3",
SemLevel::Minor
).unwrap();
assert_eq!("1.3.0", next_str);
§Errors
Returns a CompositeError
of all error surface area from Self::new_version
and
Version::next
.
Trait Implementations§
source§impl Scheme for Sem
impl Scheme for Sem
source§fn new_format(format_str: &str) -> Result<Format<'_, Self>, FormatError>
fn new_format(format_str: &str) -> Result<Format<'_, Self>, FormatError>
source§fn new_version<'vs>(
format_str: &str,
version_str: &'vs str
) -> Result<Version<'vs, Self>, CompositeError>
fn new_version<'vs>( format_str: &str, version_str: &'vs str ) -> Result<Version<'vs, Self>, CompositeError>
impl Eq for Sem
impl StructuralPartialEq for Sem
Auto Trait Implementations§
impl RefUnwindSafe for Sem
impl Send for Sem
impl Sync for Sem
impl Unpin for Sem
impl UnwindSafe for Sem
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
Mutably borrows from an owned value. Read more