pub struct Version {
pub major: u16,
pub minor: u16,
}Expand description
A major.minor version identifier for either the canonical schema or the
data-provider interface.
§Examples
use fulltime_plugin_api::Version;
let host = Version::new(1, 3);
let plugin = Version::new(1, 2);
assert!(host.accepts(plugin));Fields§
§major: u16Major version. A mismatch is always incompatible.
minor: u16Minor version. A host may run a plugin targeting an equal or lower minor version.
Implementations§
Source§impl Version
impl Version
Sourcepub const fn accepts(self, target: Self) -> bool
pub const fn accepts(self, target: Self) -> bool
Returns whether self, acting as the host’s supported version, accepts a plugin
declaring target as the version it was built against.
Compatible when the major versions match and the host’s minor version is equal to or greater than the plugin’s, since a higher host minor version is a superset of the fields or functions the plugin was built against.
§Examples
use fulltime_plugin_api::Version;
assert!(Version::new(1, 3).accepts(Version::new(1, 2)));
assert!(!Version::new(1, 1).accepts(Version::new(1, 2)));
assert!(!Version::new(2, 0).accepts(Version::new(1, 9)));Trait Implementations§
impl Copy for Version
impl Eq for Version
Source§impl FromStr for Version
impl FromStr for Version
Source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Parses a "major.minor" version string.
§Errors
Returns ParseVersionError if the string is not exactly two u16 components
separated by a single ..
§Examples
use fulltime_plugin_api::Version;
assert_eq!("1.2".parse(), Ok(Version::new(1, 2)));
assert!("1".parse::<Version>().is_err());Source§type Err = ParseVersionError
type Err = ParseVersionError
The associated error which can be returned from parsing.
Source§impl Ord for Version
impl Ord for Version
1.21.0 (const: unstable) · 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 PartialOrd for Version
impl PartialOrd for Version
impl StructuralPartialEq for Version
Auto Trait Implementations§
impl Freeze for Version
impl RefUnwindSafe for Version
impl Send for Version
impl Sync for Version
impl Unpin for Version
impl UnsafeUnpin for Version
impl UnwindSafe for Version
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