#[repr(C)]pub struct Version {
pub major: u32,
pub minor: u32,
pub patch: u32,
}Expand description
Semantic version representation.
Provides type-safe version handling with named fields instead of tuples.
§FFI Safety
This type is #[repr(C)] for predictable memory layout across dynamic
library boundaries. This ensures the struct can be safely passed to/from
dynamically loaded modules.
§Ordering
Versions are ordered lexicographically by (major, minor, patch):
1.0.0 < 1.0.1 < 1.1.0 < 2.0.0
This allows version comparison and sorting:
use reovim_kernel::api::v1::Version;
assert!(Version::new(1, 0, 0) < Version::new(1, 0, 1));
assert!(Version::new(1, 2, 0) < Version::new(2, 0, 0));
let mut versions = vec![
Version::new(2, 0, 0),
Version::new(1, 0, 1),
Version::new(1, 0, 0),
];
versions.sort();
assert_eq!(versions[0], Version::new(1, 0, 0));Fields§
§major: u32Major version - breaking changes increment this.
minor: u32Minor version - backwards-compatible additions increment this.
patch: u32Patch version - backwards-compatible fixes increment this.
Implementations§
Trait Implementations§
Source§impl Ord for Version
impl Ord for Version
Source§impl PartialOrd for Version
impl PartialOrd for Version
impl Copy for Version
impl Eq 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