[−][src]Struct versions::Chunk
A logical unit of a version number.
Can consist of multiple letters and numbers. Groups of these (i.e.
Chunks) are separated by periods to form a full
version number.
Defined as a newtype wrapper so that we can define custom parser and trait methods.
Examples
r30rc120150826
Implementations
impl Chunk[src]
pub fn single_digit(&self) -> Option<u32>[src]
If this Chunk is made up of a single Unit::Digits,
then pull out the inner value.
use versions::{Chunk, Unit}; let v = Chunk(vec![Unit::Digits(1)]); assert_eq!(Some(1), v.single_digit()); let v = Chunk(vec![Unit::Letters("abc".to_string())]); assert_eq!(None, v.single_digit()); let v = Chunk(vec![Unit::Digits(1), Unit::Letters("abc".to_string())]); assert_eq!(None, v.single_digit());
pub fn single_digit_lenient(&self) -> Option<u32>[src]
Like single_digit, but will grab the u32
even if there were more values in the Chunk.
use versions::{Chunk, Unit}; let v = Chunk(vec![Unit::Digits(1)]); assert_eq!(Some(1), v.single_digit_lenient()); let v = Chunk(vec![Unit::Letters("abc".to_string())]); assert_eq!(None, v.single_digit_lenient()); let v = Chunk(vec![Unit::Digits(0), Unit::Letters("a".to_string())]); assert_eq!(Some(0), v.single_digit_lenient());
Trait Implementations
impl Clone for Chunk[src]
impl Debug for Chunk[src]
impl Display for Chunk[src]
impl Eq for Chunk[src]
impl Hash for Chunk[src]
fn hash<__H: Hasher>(&self, state: &mut __H)[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
impl Ord for Chunk[src]
A custom implementation.
fn cmp(&self, other: &Self) -> Ordering[src]
#[must_use]fn max(self, other: Self) -> Self1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self[src]
impl PartialEq<Chunk> for Chunk[src]
impl PartialOrd<Chunk> for Chunk[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl StructuralEq for Chunk[src]
impl StructuralPartialEq for Chunk[src]
Auto Trait Implementations
impl RefUnwindSafe for Chunk
impl Send for Chunk
impl Sync for Chunk
impl Unpin for Chunk
impl UnwindSafe for Chunk
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> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
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>,