Struct version_compare::version_manifest::VersionManifest
[−]
[src]
pub struct VersionManifest { /* fields omitted */ }
Version manifest (configuration).
A manifest (configuration) that is used respectively when parsing and comparing version strings.
Methods
impl VersionManifest
[src]
Version manifest implementation.
fn new() -> Self
Constructor.
Examples
use version_compare::VersionManifest; let mut manifest = VersionManifest::new(); // Ignore text parts manifest.set_ignore_text(true);
fn max_depth(&self) -> &Option<usize>
The maximum depth of a version number. None if no depth is configured.
Examples
use version_compare::VersionManifest; let manifest = VersionManifest::new(); match manifest.max_depth() { &Some(depth) => println!("Maximum depth of {}", depth), &None => println!("No maximum depth") }
fn max_depth_number(&self) -> usize
The maximum depth of a version number as numerical value. Zero is returned if no depth is configured.
Examples
use version_compare::VersionManifest; let manifest = VersionManifest::new(); println!("Maximum depth of {}", manifest.max_depth_number());
fn set_max_depth(&mut self, max_depth: Option<usize>)
Set the maximum depth of a version number.
Examples
use version_compare::VersionManifest; let mut manifest = VersionManifest::new(); // Set the maximum depth to 3 manifest.set_max_depth(Some(3)); // Don't use a maximum depth manifest.set_max_depth(None);
fn set_max_depth_number(&mut self, max_depth: usize)
Set the maximum depth of a version number. Use zero to disable the maximum depth.
Examples
use version_compare::VersionManifest; let mut manifest = VersionManifest::new(); // Set the maximum depth to 3 manifest.set_max_depth_number(3); // Don't use a maximum depth manifest.set_max_depth_number(0);
fn has_max_depth(&self) -> bool
Check whether there's a maximum configured depth.
Examples
use version_compare::VersionManifest; let mut manifest = VersionManifest::new(); assert!(!manifest.has_max_depth()); manifest.set_max_depth(Some(3)); assert!(manifest.has_max_depth());
fn ignore_text(&self) -> bool
Check whether to ignore text parts in version numbers.
Examples
use version_compare::VersionManifest; let manifest = VersionManifest::new(); if manifest.ignore_text() { println!("Text parts are ignored"); } else { println!("Text parts are not ignored"); }
fn set_ignore_text(&mut self, ignore_text: bool)
Set whether to ignore text parts.
Examples
use version_compare::VersionManifest; let mut manifest = VersionManifest::new(); // Ignore text parts manifest.set_ignore_text(true); // Don't ignore text parts manifest.set_ignore_text(false);
Trait Implementations
impl Debug for VersionManifest
[src]
impl PartialEq for VersionManifest
[src]
fn eq(&self, __arg_0: &VersionManifest) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &VersionManifest) -> bool
This method tests for !=
.