Struct version_compare::Manifest
source · #[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
impl Manifest
Version manifest implementation.
sourcepub fn has_max_depth(&self) -> bool
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 PartialEq for Manifest
impl PartialEq for Manifest
impl Copy for Manifest
impl Eq for Manifest
impl StructuralPartialEq for Manifest
Auto Trait Implementations§
impl Freeze for Manifest
impl RefUnwindSafe for Manifest
impl Send for Manifest
impl Sync for Manifest
impl Unpin for Manifest
impl UnwindSafe for Manifest
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