pub enum Identifier {
Numeric(u64),
AlphaNumeric(String),
}
Expand description
Helper enum for holding data of alphanumeric or numeric suffix identifiers.
This enum is used to hold suffix parts of pre
and build
fields of
Version
struct. Theses suffixes may be either numeric or alphanumeric.
§Examples
Parsing Version
with pre-release part composed of two Identifier
s:
use semver_parser::version;
let version = version::parse("0.1.2-alpha1.0")?;
let expected_pre = vec![
version::Identifier::AlphaNumeric(String::from("alpha1")),
version::Identifier::Numeric(0),
];
assert_eq!(expected_pre, version.pre);
Variants§
Numeric(u64)
An identifier that’s solely numbers.
AlphaNumeric(String)
An identifier with letters and numbers.
Implementations§
Source§impl Identifier
impl Identifier
pub fn concat(self, add_str: &str) -> Identifier
Trait Implementations§
Source§impl Clone for Identifier
impl Clone for Identifier
Source§fn clone(&self) -> Identifier
fn clone(&self) -> Identifier
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for Identifier
impl Debug for Identifier
Source§impl Display for Identifier
impl Display for Identifier
Source§impl Hash for Identifier
impl Hash for Identifier
Source§impl Ord for Identifier
impl Ord for Identifier
Source§fn cmp(&self, other: &Identifier) -> Ordering
fn cmp(&self, other: &Identifier) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for Identifier
impl PartialEq for Identifier
Source§impl PartialOrd for Identifier
impl PartialOrd for Identifier
impl Eq for Identifier
impl StructuralPartialEq for Identifier
Auto Trait Implementations§
impl Freeze for Identifier
impl RefUnwindSafe for Identifier
impl Send for Identifier
impl Sync for Identifier
impl Unpin for Identifier
impl UnwindSafe for Identifier
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