pub struct BidsVersion {
pub major: u16,
pub minor: u16,
pub patch: u16,
}Expand description
A parsed BIDS specification version (SemVer).
§Examples
use bids_schema::version::BidsVersion;
let v = BidsVersion::parse("1.9.0").unwrap();
assert_eq!(v.major, 1);
assert_eq!(v.minor, 9);
assert_eq!(v.patch, 0);
let older = BidsVersion::parse("1.6.0").unwrap();
assert!(v > older);
assert!(v.is_compatible_with(&older));Fields§
§major: u16§minor: u16§patch: u16Implementations§
Source§impl BidsVersion
impl BidsVersion
Sourcepub fn parse(s: &str) -> Option<Self>
pub fn parse(s: &str) -> Option<Self>
Parse a version string like "1.9.0".
Accepts 2-part ("1.9") and 3-part ("1.9.0") versions.
Returns None if parsing fails.
Sourcepub fn is_compatible_with(&self, other: &BidsVersion) -> bool
pub fn is_compatible_with(&self, other: &BidsVersion) -> bool
Check whether this version is compatible with other.
Two versions are compatible if they share the same major version and
other is at least MIN_COMPATIBLE_VERSION.
Sourcepub fn is_older_than(&self, other: &BidsVersion) -> bool
pub fn is_older_than(&self, other: &BidsVersion) -> bool
Check whether other is from a newer spec than this version.
Sourcepub fn check_compatibility(
&self,
dataset_version: &BidsVersion,
) -> Compatibility
pub fn check_compatibility( &self, dataset_version: &BidsVersion, ) -> Compatibility
Return the compatibility status between this library version and a dataset’s declared BIDS version.
Trait Implementations§
Source§impl Clone for BidsVersion
impl Clone for BidsVersion
Source§fn clone(&self) -> BidsVersion
fn clone(&self) -> BidsVersion
Returns a duplicate 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 BidsVersion
impl Debug for BidsVersion
Source§impl Display for BidsVersion
impl Display for BidsVersion
Source§impl FromStr for BidsVersion
impl FromStr for BidsVersion
Source§impl Hash for BidsVersion
impl Hash for BidsVersion
Source§impl Ord for BidsVersion
impl Ord for BidsVersion
Source§fn cmp(&self, other: &BidsVersion) -> Ordering
fn cmp(&self, other: &BidsVersion) -> 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 BidsVersion
impl PartialEq for BidsVersion
Source§impl PartialOrd for BidsVersion
impl PartialOrd for BidsVersion
impl Copy for BidsVersion
impl Eq for BidsVersion
impl StructuralPartialEq for BidsVersion
Auto Trait Implementations§
impl Freeze for BidsVersion
impl RefUnwindSafe for BidsVersion
impl Send for BidsVersion
impl Sync for BidsVersion
impl Unpin for BidsVersion
impl UnsafeUnpin for BidsVersion
impl UnwindSafe for BidsVersion
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