#[non_exhaustive]
pub struct Manifest { pub max_depth: Option<usize>, pub ignore_text: bool, pub gnu_ordering: bool, }
Expand description

Version manifest (configuration).

A manifest (configuration) that is used respectively when parsing and comparing version strings.

§Examples

use version_compare::{Manifest, Version};

// Create manifest with max depth of 2
let mut manifest = Manifest::default();
manifest.max_depth = Some(2);

// Version strings equal with manifest because we compare up-to 2 parts deep
let a = Version::from_manifest("1.0.1", &manifest).unwrap();
let b = Version::from_manifest("1.0.2", &manifest).unwrap();
assert!(a == b);

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§max_depth: Option<usize>

The maximum depth of a version number.

This specifies the maximum number of parts. There is no limit if None is set.

§ignore_text: bool

Whether to ignore text parts in version strings.

§gnu_ordering: bool

Use GNU sort based ordering.

Enabling this modifies the ordering of numbers with a leading zero to mimick GNUs sort.

Issue: https://github.com/timvisee/version-compare/issues/27

Implementations§

source§

impl Manifest

Version manifest implementation.

source

pub fn has_max_depth(&self) -> bool

Check whether there’s a maximum configured depth.

§Examples
use version_compare::Manifest;

let mut manifest = Manifest::default();

assert!(!manifest.has_max_depth());

manifest.max_depth = Some(3);
assert!(manifest.has_max_depth());

Trait Implementations§

source§

impl Clone for Manifest

source§

fn clone(&self) -> Manifest

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 Manifest

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Manifest

source§

fn default() -> Manifest

Returns the “default value” for a type. Read more
source§

impl PartialEq for Manifest

source§

fn eq(&self, other: &Manifest) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for Manifest

source§

impl Eq for Manifest

source§

impl StructuralPartialEq for Manifest

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

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 T
where 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 T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.