pub struct MigrationVersion {
pub segments: Vec<u64>,
pub raw: String,
}Expand description
A parsed migration version, supporting dotted numeric segments (e.g., “1.2.3”).
§Equality
Two versions are equal when their numeric segments are equal after trailing
zeros are dropped: 1, 1.0 and 1.0.0 are all the same version. The
raw string is not part of the identity.
This has to match Ord, which compares zero-padded segment-wise. A
derived PartialEq would compare raw too, so 1 and 1.0 would report
Ordering::Equal from cmp while == said false — a violation of the
Ord/Eq contract that silently corrupts BTreeMap, binary_search and
dedup.
Fields§
§segments: Vec<u64>Parsed numeric segments of the version (e.g., [1, 2, 3] for "1.2.3").
raw: StringOriginal version string as it appeared in the filename.
Implementations§
Source§impl MigrationVersion
impl MigrationVersion
Sourcepub fn normalized(&self) -> &[u64]
pub fn normalized(&self) -> &[u64]
The segments with trailing zeros removed — the canonical identity used
by PartialEq, Ord and std::hash::Hash.
1.0.0 normalizes to [1], 1.2.0 to [1, 2], and 0 / 0.0 to the
empty slice (all-zero versions are equal to each other).
Trait Implementations§
Source§impl Clone for MigrationVersion
impl Clone for MigrationVersion
Source§fn clone(&self) -> MigrationVersion
fn clone(&self) -> MigrationVersion
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more